Ejemplo n.º 1
0
def test_elgamal():
    dk = elgamal_private_key(5)
    ek = elgamal_public_key(dk)
    P = ek[0]
    assert P - 1 == decipher_elgamal(encipher_elgamal(P - 1, ek), dk)
    raises(ValueError, lambda: encipher_elgamal(P, dk))
    raises(ValueError, lambda: encipher_elgamal(-1, dk))
Ejemplo n.º 2
0
def test_elgamal():
    dk = elgamal_private_key(5)
    ek = elgamal_public_key(dk)
    P = ek[0]
    assert P - 1 == decipher_elgamal(encipher_elgamal(P - 1, ek), dk)
    raises(ValueError, lambda: encipher_elgamal(P, dk))
    raises(ValueError, lambda: encipher_elgamal(-1, dk))
Ejemplo n.º 3
0
def test_elgamal():
    dk = elgamal_private_key(20)
    ek = elgamal_public_key(dk)
    m = 12345
    assert m == decipher_elgamal(encipher_elgamal(m, ek), dk)
Ejemplo n.º 4
0
def test_elgamal():
    dk = elgamal_private_key(20)
    ek = elgamal_public_key(dk)
    m = 12345
    assert m == decipher_elgamal(encipher_elgamal(m, ek), dk)
    raises(ValueError, lambda: encipher_elgamal(2000, (1031, 14, 212)))
Ejemplo n.º 5
0
def test_elgamal():
    dk = elgamal_private_key(20)
    ek = elgamal_public_key(dk)
    m = 12345
    assert m == decipher_elgamal(encipher_elgamal(m, ek), dk)
Ejemplo n.º 6
0
def test_elgamal():
    dk = elgamal_private_key(20)
    ek = elgamal_public_key(dk)
    m = 12345
    assert m == decipher_elgamal(encipher_elgamal(m, ek), dk)
    raises(ValueError, lambda: encipher_elgamal(2000, (1031, 14, 212)))