From 1aa29abc25008ae68777f4502576ff169fb62730 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 17 Aug 2016 14:51:15 +0200 Subject: [PATCH] Add crypto.py --- crypto.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 crypto.py diff --git a/crypto.py b/crypto.py new file mode 100644 index 00000000..96be68e2 --- /dev/null +++ b/crypto.py @@ -0,0 +1,17 @@ +# Separate all crypto code so that we can easily test several implementations + +import sha3 +from cryptoconditions import crypto + + +def hash_data(data): + """Hash the provided data using SHA3-256""" + return sha3.sha3_256(data.encode()).hexdigest() + + +def generate_key_pair(): + sk, pk = crypto.ed25519_generate_key_pair() + return sk.decode(), pk.decode() + +SigningKey = crypto.Ed25519SigningKey +VerifyingKey = crypto.Ed25519VerifyingKey