CircuitPython version
Adafruit CircuitPython 8.0.3 on 2023-02-23; Raspberry Pi Pico W with rp2040
Adafruit-Blinka 8.16.1 on Raspberry pi 2B
Code/REPL
Pi pico:
AES_KEY = "Sixteen byte key"
message = "hello world worldd"
encrypted_message = bytearray(len(message))
cipher = aesio.AES(AES_KEY, aesio.MODE_CTR, AES_KEY)
cipher.encrypt_into(bytes(message, "utf-8"), encrypted_message)
RPI 2b:
from Crypto.Cipher import AES
AES_KEY = "Sixteen byte key"
crypto = AES.new(AES_KEY, AES.MODE_CTR, AES_KEY, counter=lambda: bytes(AES_KEY, "utf-8"))
decrypted_message = crypto.decrypt(bytes(encrypted_message))
Behavior
Output on the RPI 2b, after decrypting is:
----------------68 65 6C 6C 6F 20 77 6F 72 6C 64 20 77 6F 72 6C 17 A0 (hex)
But should be: 68 65 6C 6C 6F 20 77 6F 72 6C 64 20 77 6F 72 6C 64 64
Description
When the length of message is larger than 16 characters, decrypted message doesn't correspond to the message which was encrypted at the beginning.
It is possible that I use the AES library on rpi 2b wrong. Mainly the counter argument, but im not sure as it is working for shorter messages.
Alternatively is it possible to use aesio module on RPI ?
Additional information
No response
CircuitPython version
Code/REPL
Behavior
Output on the RPI 2b, after decrypting is:
----------------68 65 6C 6C 6F 20 77 6F 72 6C 64 20 77 6F 72 6C 17 A0 (hex)
But should be: 68 65 6C 6C 6F 20 77 6F 72 6C 64 20 77 6F 72 6C 64 64
Description
When the length of message is larger than 16 characters, decrypted message doesn't correspond to the message which was encrypted at the beginning.
It is possible that I use the AES library on rpi 2b wrong. Mainly the counter argument, but im not sure as it is working for shorter messages.
Alternatively is it possible to use aesio module on RPI ?
Additional information
No response