From d24f3a490ad3224a71bc5b9f8ee91e84dba3e3c9 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 7 Jun 2022 15:21:19 +0200 Subject: [PATCH] Added internal abstraction to SHA-256 --- RNS/Cryptography/Hashes.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 RNS/Cryptography/Hashes.py diff --git a/RNS/Cryptography/Hashes.py b/RNS/Cryptography/Hashes.py new file mode 100644 index 0000000..cea0f87 --- /dev/null +++ b/RNS/Cryptography/Hashes.py @@ -0,0 +1,14 @@ +import hashlib + + +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() \ No newline at end of file