salt should be shared across H dummies

This commit is contained in:
Robert Bendun 2024-04-17 22:39:25 +02:00
parent 39e5df2cfb
commit 1aca203119

View File

@ -9,13 +9,15 @@ m0 = b"alice"
m1 = b"bob" m1 = b"bob"
c = False c = False
q = 224
curve = curves.Curve.get_curve('NIST-P224') curve = curves.Curve.get_curve('NIST-P224')
q = curve.size
g = curve.generator g = curve.generator
salt = Crypto.Random.get_random_bytes(16)
def H(p: curves.Point) -> bytes: def H(p: curves.Point) -> bytes:
print("H({p})")
secret = pickle.dumps((p.x, p.y), protocol=4) secret = pickle.dumps((p.x, p.y), protocol=4)
salt = Crypto.Random.get_random_bytes(16)
key = Crypto.Protocol.KDF.scrypt(secret, salt, 16, N=2**14, r=8, p=1) key = Crypto.Protocol.KDF.scrypt(secret, salt, 16, N=2**14, r=8, p=1)
return key[:32] # first 32 bytes of generated key return key[:32] # first 32 bytes of generated key