1from binascii import hexlify
2
3from spake2 import SPAKE2_A, SPAKE2_B
4
5
6shared_password = b"This Is The Password!"
7
8alice = SPAKE2_A(shared_password)
9alice_msg = alice.start()
10
11bob = SPAKE2_B(shared_password)
12bob_msg = bob.start()
13
14# Alice and Bob exchange their messages...
15
16alice_key = alice.finish(bob_msg)
17bob_key = bob.finish(alice_msg)
18
19print("alice_key:", hexlify(alice_key))
20print("  bob_key:", hexlify(bob_key))
21
22assert alice_key == bob_key
23