Merge branch 'hashlib_faster' into intint

This commit is contained in:
J. Nick Koston 2024-01-25 22:25:02 -10:00
commit 8c8b97f69d
No known key found for this signature in database

View File

@ -473,13 +473,9 @@ class KlapEncryptionSession:
padder = padding.PKCS7(128).padder()
padded_data = padder.update(msg) + padder.finalize()
ciphertext = encryptor.update(padded_data) + encryptor.finalize()
digest = hashes.Hash(hashes.SHA256())
digest.update(
signature = hashlib.sha256(
self._sig + self._seq.to_bytes(4, "big", signed=True) + ciphertext
)
signature = digest.finalize()
).digest()
return (signature + ciphertext, self._seq)
def decrypt(self, msg):