Use secure random number generator for document ID generation
Showing
2 changed files
with
2 additions
and
1 deletions
@@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
9 | - Add support for creating PDF/A 3b [ilaurillard] | 9 | - Add support for creating PDF/A 3b [ilaurillard] |
10 | - Add helper functions to replace text styles and cell content [Brian Kayfitz] | 10 | - Add helper functions to replace text styles and cell content [Brian Kayfitz] |
11 | - Fix TextStyle merge decoration [AtlasAutocode] | 11 | - Fix TextStyle merge decoration [AtlasAutocode] |
12 | +- Use secure random number generator for document ID generation | ||
12 | 13 | ||
13 | ## 3.11.1 | 14 | ## 3.11.1 |
14 | 15 |
@@ -177,7 +177,7 @@ class PdfDocument { | @@ -177,7 +177,7 @@ class PdfDocument { | ||
177 | /// Generates the document ID | 177 | /// Generates the document ID |
178 | Uint8List get documentID { | 178 | Uint8List get documentID { |
179 | if (_documentID == null) { | 179 | if (_documentID == null) { |
180 | - final rnd = math.Random(); | 180 | + final rnd = math.Random.secure(); |
181 | _documentID = Uint8List.fromList(sha256 | 181 | _documentID = Uint8List.fromList(sha256 |
182 | .convert(DateTime.now().toIso8601String().codeUnits + | 182 | .convert(DateTime.now().toIso8601String().codeUnits + |
183 | List<int>.generate(32, (_) => rnd.nextInt(256))) | 183 | List<int>.generate(32, (_) => rnd.nextInt(256))) |
-
Please register or login to post a comment