Last active
October 23, 2022 05:59
-
-
Save paulsc/07c7741b11ca3897c3c0acafc9e642bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encodePkcs1Suffix(self, message): | |
messageHash = self.hashAlg.digester(message.encode("utf-8")).digest() | |
if messageHash[-1] & 0x01 != 0x01: | |
print( | |
"Hash value must be uneven. Try a different message or a different | |
hash algorithm", | |
file=stderr, | |
) | |
exit(1) | |
suffix = bytes([0]) + self.hashAlg.digestInfo + messageHash | |
return suffix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment