pad the payload for AES encryption (16) (#92)
This commit is contained in:
parent
f1d62380c9
commit
f7e30344c5
1 changed files with 6 additions and 1 deletions
|
@ -245,6 +245,11 @@ class device:
|
||||||
packet[0x32] = self.id[2]
|
packet[0x32] = self.id[2]
|
||||||
packet[0x33] = self.id[3]
|
packet[0x33] = self.id[3]
|
||||||
|
|
||||||
|
# pad the payload for AES encryption
|
||||||
|
if len(payload)>0:
|
||||||
|
numpad=(len(payload)//16+1)*16
|
||||||
|
payload=payload.ljust(numpad,"\x00")
|
||||||
|
|
||||||
checksum = 0xbeaf
|
checksum = 0xbeaf
|
||||||
for i in range(len(payload)):
|
for i in range(len(payload)):
|
||||||
checksum += payload[i]
|
checksum += payload[i]
|
||||||
|
|
Loading…
Reference in a new issue