Skip to content

Commit

Permalink
If on Python 3.9+, set usedforsecurity parameter to False
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloAlexis611 authored and brechtm committed Mar 24, 2024
1 parent 26635ef commit 9002087
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rinoh/backend/pdf/cos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Public License v3. See the LICENSE file or http:https://www.gnu.org/licenses/.


import hashlib, time
import hashlib, time, sys

from binascii import hexlify
from codecs import BOM_UTF16_BE
Expand Down Expand Up @@ -566,7 +566,8 @@ def out(string):
trailer['Size'] = Integer(self.max_identifier + 1)
trailer['Root'] = self.catalog
trailer['Info'] = self.info
md5sum = hashlib.md5()
# If using Python 3.9 or later, set usedforsecurity to False
md5sum = hashlib.md5() if sys.version_info < (3, 9) else hashlib.md5(usedforsecurity=False)
md5sum.update(str(self.timestamp).encode())
md5sum.update(str(file.tell()).encode())
for value in self.info.values():
Expand Down

0 comments on commit 9002087

Please sign in to comment.