Moved hashing to native python3 hashlib

This commit is contained in:
Mark Qvist 2022-06-07 12:51:41 +02:00
parent 379e56b2ce
commit 715a84c6f2
2 changed files with 5 additions and 8 deletions

View file

@ -27,9 +27,10 @@ import RNS
import time
import atexit
import base64
import hashlib
from .vendor import umsgpack as umsgpack
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey, Ed25519PublicKey
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey, X25519PublicKey
@ -158,10 +159,10 @@ class Identity:
:param data: Data to be hashed as *bytes*.
:returns: SHA-256 hash as *bytes*
"""
digest = hashes.Hash(hashes.SHA256(), backend=default_backend())
digest = hashlib.sha256()
digest.update(data)
return digest.finalize()
return digest.digest()
@staticmethod
def truncated_hash(data):