salt should be shared across H dummies
This commit is contained in:
parent
39e5df2cfb
commit
1aca203119
8
main.py
8
main.py
@ -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
|
||||||
|
|
||||||
def H(p: curves.Point) -> bytes:
|
|
||||||
secret = pickle.dumps((p.x, p.y), protocol=4)
|
|
||||||
salt = Crypto.Random.get_random_bytes(16)
|
salt = Crypto.Random.get_random_bytes(16)
|
||||||
|
|
||||||
|
def H(p: curves.Point) -> bytes:
|
||||||
|
print("H({p})")
|
||||||
|
secret = pickle.dumps((p.x, p.y), protocol=4)
|
||||||
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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user