Пример #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))
Пример #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))
Пример #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)
Пример #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)))
Пример #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)
Пример #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)))