Skip to content

Commit f7acacc

Browse files
committed
[dargon2_interface] Allow variable salth lengths
1 parent 48fa1f3 commit f7acacc

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

dargon2_interface/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.1.1
2+
- Fix Salts not being able to be generated with lengths different than 16 bytes
3+
14
## 1.1.0
25
- Fix repository & homepage links to point to newly structured repo
36
- Match versioning for dargon2_flutter's desktop support addition

dargon2_interface/lib/src/salt.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Salt {
2020
/// Optionally accepts a [length] of type int to create salts
2121
/// of a length that the user inputs.
2222
factory Salt.newSalt({int length = 16}) {
23-
return Salt(_getRandomBytes(16));
23+
return Salt(_getRandomBytes(length));
2424
}
2525

2626
/// The method to get a List of random secure bytes with given length.
@@ -30,8 +30,8 @@ class Salt {
3030
///
3131
/// Returns a [List] of type int with random bytes.
3232
static List<int> _getRandomBytes([int length = 16]) {
33-
final _random = Random.secure();
34-
return List<int>.generate(length, (i) => _random.nextInt(256));
33+
final random = Random.secure();
34+
return List<int>.generate(length, (i) => random.nextInt(256));
3535
}
3636

3737
/// A getter to get the bytes stored in the object.

dargon2_interface/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,4 @@ packages:
370370
source: hosted
371371
version: "3.1.1"
372372
sdks:
373-
dart: ">=2.19.0 <3.0.0"
373+
dart: ">=2.19.0 <4.0.0"

dargon2_interface/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: dargon2_interface
22
description: An interface for all dargon2 hashing functions. Provides the base outline for all implementations.
3-
version: 1.1.0
3+
version: 1.1.1
44
homepage: https://github.com/tmthecoder/dargon2/blob/main/dargon2_interface
55
repository: https://github.com/tmthecoder/dargon2
66

77
environment:
8-
sdk: '>=2.14.0 <3.0.0'
8+
sdk: '>=2.14.0 <4.0.0'
99

1010
dependencies:
1111
convert: ^3.0.1

0 commit comments

Comments
 (0)