Skip to content

Commit

Permalink
Use secure random number generator for document ID generation
Browse files Browse the repository at this point in the history
  • Loading branch information
DavBfr committed Jan 17, 2025
1 parent 426086f commit bee3fc2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pdf/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Add support for creating PDF/A 3b [ilaurillard]
- Add helper functions to replace text styles and cell content [Brian Kayfitz]
- Fix TextStyle merge decoration [AtlasAutocode]
- Use secure random number generator for document ID generation

## 3.11.1

Expand Down
2 changes: 1 addition & 1 deletion pdf/lib/src/pdf/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class PdfDocument {
/// Generates the document ID
Uint8List get documentID {
if (_documentID == null) {
final rnd = math.Random();
final rnd = math.Random.secure();
_documentID = Uint8List.fromList(sha256
.convert(DateTime.now().toIso8601String().codeUnits +
List<int>.generate(32, (_) => rnd.nextInt(256)))
Expand Down

0 comments on commit bee3fc2

Please sign in to comment.