I'm trying to perform the modulus of a value in python, but I'm getting errors as it's interpretting the modulus as a string formatting constant, from my knowledge. My initial guess would be to type cast this, but then it hangs.
val = pow(a,n,p)
val = y1*val
val = val % p
Are the two lines of code corresponding to this question. Right now, when I run this, I get: TypeError: not all arguments converted during string formatting At the second line.
If I wrap val into an integer and type cast it...it takes extremely long to calculate.
I'm not too skilled with python, my guess is I'm missing something simple, but what?
y1? Assuming it's a string,val = y1*valalso produces a string. It's probably helpful to printrepr(val)after each step for debugging.y1is a string (which would result invalalso being a string in the last line).