def test_simple_client_decode(encode_Alice_message): private_key, Alice_message = encode_Alice_message # Ensure the mix can decode the message correctly res1 = mix_server_one_hop(private_key, [Alice_message]) assert len(res1) == 1 assert res1[0][0] == b"Alice" assert res1[0][1] == b"Dear Alice,\nHello!\nBob"
def test_simple_client_decode_many(): from os import urandom G = EcGroup() g = G.generator() o = G.order() private_key = o.random() public_key = private_key * g messages = [] for _ in range(100): m = mix_client_one_hop(public_key, urandom(256), urandom(1000)) messages += [m] # Ensure the mix can decode the message correctly res1 = mix_server_one_hop(private_key, messages) assert len(res1) == 100