Moved hashing to native python3 hashlib
This commit is contained in:
parent
379e56b2ce
commit
715a84c6f2
@ -26,7 +26,6 @@ import time
|
||||
import RNS
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
|
||||
class Callbacks:
|
||||
@ -97,10 +96,7 @@ class Destination:
|
||||
name = Destination.full_name(app_name, *aspects)
|
||||
|
||||
# Create a digest for the destination
|
||||
digest = hashes.Hash(hashes.SHA256(), backend=default_backend())
|
||||
digest.update(name.encode("UTF-8"))
|
||||
|
||||
return digest.finalize()[:10]
|
||||
return RNS.Identity.full_hash(name.encode("utf-8"))[:RNS.Reticulum.TRUNCATED_HASHLENGTH//8]
|
||||
|
||||
@staticmethod
|
||||
def app_and_aspects_from_name(full_name):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user