mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-14 03:20:14 +01:00
Restore Python 3 support (#95)
Use explicit byte literals.
AES encryption padding broken with commit f7e30344c5
under Python 3.
Python 3 support when using pyaes (instead of Crypto.Cipher.AES) now works.
This commit is contained in:
parent
8d3c9f1e9f
commit
8b593beff9
@ -182,11 +182,11 @@ class device:
|
||||
|
||||
def encrypt_pyaes(self, payload):
|
||||
aes = pyaes.AESModeOfOperationCBC(self.key, iv = bytes(self.iv))
|
||||
return "".join([aes.encrypt(bytes(payload[i:i+16])) for i in range(0, len(payload), 16)])
|
||||
return b"".join([aes.encrypt(bytes(payload[i:i+16])) for i in range(0, len(payload), 16)])
|
||||
|
||||
def decrypt_pyaes(self, payload):
|
||||
aes = pyaes.AESModeOfOperationCBC(self.key, iv = bytes(self.iv))
|
||||
return "".join([aes.decrypt(bytes(payload[i:i+16])) for i in range(0, len(payload), 16)])
|
||||
return b"".join([aes.decrypt(bytes(payload[i:i+16])) for i in range(0, len(payload), 16)])
|
||||
|
||||
def encrypt_pycrypto(self, payload):
|
||||
aes = AES.new(bytes(self.key), AES.MODE_CBC, bytes(self.iv))
|
||||
|
Loading…
Reference in New Issue
Block a user