Skip to content

Commit aef6a03

Browse files
committed
fix: revert A01 padding
1 parent 0372d41 commit aef6a03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

roborock/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _encode(self, obj, context, _):
276276
if context.version == b"A01":
277277
iv = md5hex(format(context.random, "08x") + A01_HASH)[8:24]
278278
decipher = AES.new(bytes(context.search("local_key"), "utf-8"), AES.MODE_CBC, bytes(iv, "utf-8"))
279-
return decipher.encrypt(pad(obj, AES.block_size))
279+
return decipher.encrypt(obj)
280280
elif context.version == b"B01":
281281
iv = md5hex(f"{context.random:08x}" + B01_HASH)[9:25]
282282
decipher = AES.new(bytes(context.search("local_key"), "utf-8"), AES.MODE_CBC, bytes(iv, "utf-8"))
@@ -300,7 +300,7 @@ def _decode(self, obj, context, _):
300300
if context.version == b"A01":
301301
iv = md5hex(format(context.random, "08x") + A01_HASH)[8:24]
302302
decipher = AES.new(bytes(context.search("local_key"), "utf-8"), AES.MODE_CBC, bytes(iv, "utf-8"))
303-
return unpad(decipher.decrypt(obj), AES.block_size)
303+
return decipher.decrypt(obj)
304304
elif context.version == b"B01":
305305
iv = md5hex(f"{context.random:08x}" + B01_HASH)[9:25]
306306
decipher = AES.new(bytes(context.search("local_key"), "utf-8"), AES.MODE_CBC, bytes(iv, "utf-8"))

0 commit comments

Comments
 (0)