about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelipe Martins Diel <41558831+felipediel@users.noreply.github.com>2020-04-13T20·42-0300
committerGitHub <noreply@github.com>2020-04-13T20·42-0300
commita5925063f9a60ffe2ad3ff92bf5ddb30c9463000 (patch)
treecb6e4ff69232c4bd1d771e535f1ae91aad91b1a9
parent3a6d89aff29dd274d0d7c632147a19647a1fe776 (diff)
Fix padding algorithm for CBC mode
Due to the lack of a parenthesis, the packets were getting 16 bytes larger than necessary.
-rw-r--r--broadlink/__init__.py2
1 files changed, 1 insertions, 1 deletions
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