Added internal python-only implementation of Ed25519

This commit is contained in:
Mark Qvist 2022-06-08 19:47:09 +02:00
parent 34efbc6100
commit e0b795b4d0
12 changed files with 845 additions and 37 deletions

View file

@ -1,14 +1,20 @@
import hashlib
"""
The SHA primitives are abstracted here to allow platform-
aware hardware acceleration in the future. Currently only
uses Python's internal SHA-256 implementation. All SHA-256
calls in RNS end up here.
"""
def sha256(data):
"""
The SHA-256 primitive is abstracted here to allow platform-
aware hardware acceleration in the future. Currently only
uses Python's internal SHA-256 implementation. All SHA-256
calls in RNS end up here.
"""
digest = hashlib.sha256()
digest.update(data)
return digest.digest()
return digest.digest()
def sha512(data):
digest = hashlib.sha512()
digest.update(data)
return digest.digest()