jimmo wrote: ↑Thu Feb 04, 2021 5:40 am
Not quite sure I understand what you're asking, but when MicroPython (and Python) print a bytes or bytearray object, it attempts to print like a regular string, but any byte that isn't a printable ascii character gets shown as \xAA (where AA is the hex of that byte).
thanks! exactly what i meant.
jimmo wrote: ↑Thu Feb 04, 2021 5:40 am
I think the issue there might be the handling of the key -- in the Python example, key is expected to be a 128-bit/256-bit (i.e. 16 or 32 bytes) bytearray. Whereas in the PHP example, the AES key is generated from the SHA1 of the password.
thanks again. quiet obvious
now that i try to decrypt a message from php there's a buffer required.
tried creating preallocated bytearray() and array(), buffer() doesn't seem to exist on micropython, do i need to create an object?
Code: Select all
File "mpyaes.py", line 117, in decrypt
TypeError: object with buffer protocol required
message tried to decode:
Code: Select all
b'\xfa3,\xa3\x1b\x9f\xcav\x0er\xa1\xac\\F\xffx\xc0\xc2_}\xfa\x00\xe5\xe6\xe9\xf5\x9d}>y>\x03\x85\xe1\xc8!MZ\x07\xea[\x9aN\xb7S\x1dz \x02n2\xf7l\xe5\xc8\xd5\xcaz\x14\x93\xc1\xb8L\x04'