I try to do this:
@pyimport Crypto.Cipher.AES as AES
@pyimport Crypto.Hash.SHA256 as SHA256
key = "hello world"
hash = SHA256.new()
hash[:update](key)
secret = hash[:digest]()
cipher = AES.new(secret)
but I get the following error:
PyError (Ptr) <type 'exceptions.UnicodeDecodeError'>
UnicodeDecodeError('utf8',
"\xb9M'\xb9\x93M>\x08\xa5.R\xd7\xda}\xab\xfa\xc4\x84\xef\xe3zS\x80\xee\x90\x88\xf7\xac\xe2\xef\xcd\xe9",
0, 1, 'invalid start byte')
while loading In[99], in expression starting on line 7
in pyerr_check at C:\Users\ross\.julia\v0.3\PyCall\src\exception.jl:58
Seems secret is a utf8string, and I tried to use
typeof(bytestring(secret)), but it gives me back utf8string which I can't
understand why.
How to make this work..?