From bee3fc2d8c7ebd3d0e5fa03c4a78c5dc9da3f2fa Mon Sep 17 00:00:00 2001 From: David PHAM-VAN Date: Fri, 17 Jan 2025 08:26:34 -0400 Subject: [PATCH] Use secure random number generator for document ID generation --- pdf/CHANGELOG.md | 1 + pdf/lib/src/pdf/document.dart | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pdf/CHANGELOG.md b/pdf/CHANGELOG.md index 949723a3..04f713e8 100644 --- a/pdf/CHANGELOG.md +++ b/pdf/CHANGELOG.md @@ -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 diff --git a/pdf/lib/src/pdf/document.dart b/pdf/lib/src/pdf/document.dart index 928c8f0d..207a42c9 100644 --- a/pdf/lib/src/pdf/document.dart +++ b/pdf/lib/src/pdf/document.dart @@ -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.generate(32, (_) => rnd.nextInt(256)))