Removes unnecessary encoding when unhexlifying

binascii.unhexlify(x) is equal to binascii.unhexlify(x.encode())
This commit is contained in:
Sergi Delgado Segura
2019-12-17 11:35:28 +01:00
parent 1184b4648a
commit 46a7fa824f
3 changed files with 4 additions and 4 deletions

View File

@@ -132,7 +132,7 @@ class Cryptographer:
# Decrypt
cipher = ChaCha20Poly1305(sk)
data = unhexlify(encrypted_blob.data.encode())
data = unhexlify(encrypted_blob.data)
try:
blob = cipher.decrypt(nonce=nonce, data=data, associated_data=None)
@@ -278,7 +278,7 @@ class Cryptographer:
return False
if isinstance(signature, str):
signature = unhexlify(signature.encode("utf-8"))
signature = unhexlify(signature)
try:
pk.verify(signature, message, ec.ECDSA(hashes.SHA256()))