0

Possible Duplicate:
Pass list to AES key generator in PyCrypto

I'm making a wrapper for an API by porting JavaScript to Python.

It passes a list as the key into an AES generator e.g:

[1885434739, 825373440, 0, 0]

However this gives me the error:

TypeError: 'list' does not support the buffer interface

Does anyone know how I can get Pycrypto AES encryption working with a list as the key, since it's an API I can't change it's requirement that the input is a list. Thank you.

example of current code:

test_key = [1885434739, 825373440, 0, 0]
aes = AES.new(test_key, AES.MODE_ECB)
print(aes)
Community
  • 1
  • 1
keekers
  • 33
  • 4
  • @keekers: I'll admit I chuckled, because I am quite juvenile. However, the powers that be on this site frown about those sorts of comments. More on topic, why do you need another question to ask the same thing? – President James K. Polk Feb 03 '13 at 20:44
  • GregS: I forgot i asked the question before, and just happened to be stuck on the same thing again. Anyway, fixed it now using AES.new(key, AES.MODE_CBC, '\0' * 16) – keekers Feb 03 '13 at 21:04

0 Answers0