Skip to content

Commit 24f8f46

Browse files
committed
Use secure random generator by default
1 parent c6ac6dc commit 24f8f46

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 1.19.0
1+
# 1.19.1
22

33
- Improve support for random generator
44
- `HashlibRandom` class for generating random number, bool, strings etc.
@@ -9,6 +9,7 @@
99
- `consumeAs` is renamed to `stringStraem` .
1010
- Introduced `byteStream`
1111
- Adds `fillNumbers` to fill List<int> with random integers.
12+
- Use secure random generator by default
1213

1314
# 1.18.1
1415

lib/src/random.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export 'package:hashlib/src/core/hashlib_random.dart';
1111
@pragma('vm:prefer-inline')
1212
Uint8List randomBytes(
1313
int length, {
14-
RandomGenerator generator = RandomGenerator.system,
14+
RandomGenerator generator = RandomGenerator.secure,
1515
}) =>
1616
HashlibRandom(generator).nextBytes(length);
1717

1818
/// Generate a list of random 32-bit numbers of size [length]
1919
@pragma('vm:prefer-inline')
2020
Uint32List randomNumbers(
2121
int length, {
22-
RandomGenerator generator = RandomGenerator.system,
22+
RandomGenerator generator = RandomGenerator.secure,
2323
}) =>
2424
HashlibRandom(generator).nextNumbers(length);
2525

@@ -31,7 +31,7 @@ void fillRandom(
3131
ByteBuffer buffer, {
3232
int start = 0,
3333
int? length,
34-
RandomGenerator generator = RandomGenerator.system,
34+
RandomGenerator generator = RandomGenerator.secure,
3535
}) =>
3636
HashlibRandom(generator).fill(buffer, start, length);
3737

@@ -42,7 +42,7 @@ void fillNumbers(
4242
List<int> list, {
4343
int start = 0,
4444
int? length,
45-
RandomGenerator generator = RandomGenerator.system,
45+
RandomGenerator generator = RandomGenerator.secure,
4646
}) {
4747
int n = length ?? list.length;
4848
if (n == 0) return;
@@ -65,7 +65,7 @@ String randomString(
6565
bool? punctuations,
6666
List<int>? whitelist,
6767
List<int>? blacklist,
68-
RandomGenerator generator = RandomGenerator.system,
68+
RandomGenerator generator = RandomGenerator.secure,
6969
}) =>
7070
HashlibRandom(generator).nextString(
7171
length,

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: hashlib
22
description: Secure hash functions, checksum generators, and key derivation algorithms optimized for Dart.
33
homepage: https://github.com/bitanon/hashlib
4-
version: 1.19.0
4+
version: 1.19.1
55

66
environment:
77
sdk: '>=2.14.0 <4.0.0'

0 commit comments

Comments
 (0)