From a5925063f9a60ffe2ad3ff92bf5ddb30c9463000 Mon Sep 17 00:00:00 2001 From: Felipe Martins Diel <41558831+felipediel@users.noreply.github.com> Date: Mon, 13 Apr 2020 17:42:51 -0300 Subject: Fix padding algorithm for CBC mode Due to the lack of a parenthesis, the packets were getting 16 bytes larger than necessary. --- broadlink/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/broadlink/__init__.py b/broadlink/__init__.py index 49309c21f1..ede6c3129a 100644 --- a/broadlink/__init__.py +++ b/broadlink/__init__.py @@ -265,7 +265,7 @@ class device: # pad the payload for AES encryption if payload: - payload += bytearray(16 - len(payload)%16) + payload += bytearray((16 - len(payload)) % 16) checksum = adler32(payload, 0xbeaf) & 0xffff packet[0x34] = checksum & 0xff -- cgit 1.4.1