CODE
start_time1 = time.time()
ec = EC(a, b, num)
g, _ = ec.at(at)
assert ec.order(g) <= ec.q
# ElGamal enc/dec usage
eg = ElGamal(ec, g)
# mapping value to ec point
# "masking": value k to point ec.mul(g, k)
# ("imbedding" on proper n:use a point of x as 0 <= n*v <= x < n*(v+1) < q)
mapping = [ec.mul(g, i) for i in range(eg.n)]
plain = mapping[at]
pub = eg.gen(priv)
cipher = eg.enc(plain, pub, r)
decoded = eg.dec(cipher, priv)
assert decoded == plain
assert cipher != pub
average_time1 = time.time() - start_time1
ERROR TRACEBACK
Exception Traceback (most recent call last)
<ipython-input-2-77934393a2f8> in <module>
256
257 ec = EC(a, b, num)
--> 258 g, _ = ec.at(at)
259 assert ec.order(g) <= ec.q
260
1 frames
<ipython-input-2-77934393a2f8> in sqrt(n, q)
85 return (i, q - i)
86 pass
---> 87 raise Exception("not found")
88
89
Exception: not found
Donot know what to do with this error.This is basically an ECC Cryptography Code in Python.
I found this on the stack overflow -
use \Exception as Exception;
But Error.