I have a program on python what is not quite running can someone tell me the error? Here is the code:
def pow_mod(x, y, z)
"Calculate (x ** y) % z efficiently." number = 1 while y: if y & 1: number = number * x % z y >>= 1 x = x * x % z return number
p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
compressed_key = 0207843cb94c2398d41b34870d23d09143fab3d9014fc62eedd766fc54d8281b19 y_parity = int(compressed_key[:2]) – 2
x = int(compressed_key[2:], 16)
a = (pow_mod(x, 3, p) + 7) % p
y = pow_mod(a, (p+1)//4, p)
if y % 2 != y_parity:
y = -y % p
uncompressed_key = ’04{:x}{:x}’.format(x, y)
print(uncompressed_key)
and for def pow_mod I implemented another file:
#include unsigned long pow_mod(unsigned short x, unsigned long y, unsigned short z) { unsigned long number = 1; while (y) { if (y & 1) number = number * x % z; y >>= 1; x = (unsigned long)x * x % z; } return number; } int main() { printf(“%d\n”, pow_mod(63437, 3935969939, 20628)); return 0; }
I would be happy about your answers and ideas and thank you in advance.