mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-29 14:58:44 +10:00
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
-1
@@ -6,7 +6,7 @@ import 'package:cryptography/cryptography.dart';
|
|||||||
|
|
||||||
Uint8List randomBytes(int length) {
|
Uint8List randomBytes(int length) {
|
||||||
final random = Random.secure();
|
final random = Random.secure();
|
||||||
final bytes = Uint8List(32);
|
final bytes = Uint8List(length);
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
bytes[i] = random.nextInt(256);
|
bytes[i] = random.nextInt(256);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user