test dhke

This commit is contained in:
callebtc
2022-10-16 13:19:31 +02:00
parent 84cc6853e8
commit 99d14352d7
2 changed files with 70 additions and 4 deletions

View File

@@ -44,9 +44,12 @@ def hash_to_curve(message: bytes):
return point
def step1_alice(secret_msg: str):
def step1_alice(secret_msg: str, blinding_factor: bytes = None):
Y = hash_to_curve(secret_msg.encode("utf-8"))
r = PrivateKey()
if blinding_factor:
r = PrivateKey(privkey=blinding_factor, raw=True)
else:
r = PrivateKey()
B_ = Y + r.pubkey
return B_, r