Fix randomBytes to use specified length
Previously we were creating a 32-byte list no matter what was asked for.
This commit is contained in:
1 parent
e1a4900dc0
commit
68d2250afc
1 file changed
+1
-1
+1
-1
@@ -6,7 +6,7 @@ import 'package:cryptography/cryptography.dart';
|
||||
|
||||
Uint8List randomBytes(int length) {
|
||||
final random = Random.secure();
|
||||
final bytes = Uint8List(32);
|
||||
final bytes = Uint8List(length);
|
||||
for (int i = 0; i < length; i++) {
|
||||
bytes[i] = random.nextInt(256);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user