我想解密一些使用RC4密码加密的数据。
我有12个字节的解密密钥,但是密钥是二进制的。那么,如何在代码中用十六进制对密钥进行硬编码?
#! /usr/bin/python
from Crypto.Cipher import ARC4
# The key looks like this in hex bytes: 0xaa 0xbb 0xcc 0xdd 0xee 0xff 0xaa 0xbb 0xcc 0dd 0xee 0xff
key = '' # How do I hardcode the key here?
obj = ARC4.new(key)
f = open('data','rb')
data = f.read()
f.close()
decrypted = obj.decrypt(data)
print decrypted