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:
Seth Golub
2026-07-04 18:34:11 -07:00
parent e1a4900dc0
commit 68d2250afc
+1 -1
View File
@@ -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);
}