You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pyHS100 has a working encrypt/decrypt function in protocol.py which should be used to fixed new firmware/devices issue. See below for the code I literally copied from that project:
# Encryption and Decryption of TP-Link Smart Home Protocol
# XOR Autokey Cipher with starting key = 171
def encrypt(request: str) -> bytearray:
key = 171
plainbytes = request.encode()
buffer = bytearray(struct.pack(">I", len(plainbytes)))
for plainbyte in plainbytes:
cipherbyte = key ^ plainbyte
key = cipherbyte
buffer.append(cipherbyte)
return bytes(buffer)
def decrypt(ciphertext: bytes) -> str:
key = 171
buffer = []
for cipherbyte in ciphertext:
plainbyte = key ^ cipherbyte
key = cipherbyte
buffer.append(plainbyte)
plaintext = bytes(buffer)
return plaintext.decode()
The text was updated successfully, but these errors were encountered:
The pyHS100 has a working encrypt/decrypt function in protocol.py which should be used to fixed new firmware/devices issue. See below for the code I literally copied from that project:
The text was updated successfully, but these errors were encountered: