Trying to build a program that will compute discrete log modulo a prime p. I am attempting to perform this using a meet-in-the-middle approach. Build a hash table like this:
lhs = [powmod(g,i,p) for i in range(2**20)]
And then call this;
with open("temp1.red","w") as f:
pickle.dump(lhs,f)
f.close()
print ("calculate 1/2^20 array")
lhs = [xgcd(i,p)[1] for i in lhs]
When it hits the dump method it thr5ows a TypeError exception:
Traceback (most recent call last):
File "C:\Users\lincoln\Desktop\eclipse-standard-luna-R-win32-x86_64\workspace\Python 3\src\Modulo.py", line 150, in <module>
pickle.dump(lhs,f)
TypeError: must be str, not bytes
I am using Python 3.4. Any ideas?