ifduyue / xxtea

Python extension module xxtea
https://pypi.org/project/xxtea/
BSD 2-Clause "Simplified" License
29 stars 11 forks source link

bytes count changes? C code can't decrypt #13

Closed huhutm closed 7 years ago

huhutm commented 8 years ago

I use this lib to encrypt 16byte data, after encrypt the data length is 20bytes. Bute C code xxtea will not change the length. Why?

ifduyue commented 8 years ago

@huhutm This is because encrypted data was padded.

Though the data length changed, there would be no problem decrypting it.

huhutm commented 7 years ago

@ifduyue But After I encrypt use the lib, I can't decrypt it with another C program. The C program only decrypt 16 bytes data.

ifduyue commented 7 years ago

But After I encrypt use the lib, I can't decrypt it with another C program. The C program only decrypt 16 bytes data.

Please read the readme https://github.com/ifduyue/xxtea#xxtea--

The XXTEA algorithm takes a 128-bit key and operates on an array of 32-bit integers (at least 2 integers), but it doesn't define the conversions between bytes and array. Due to this reason, many XXTEA implementations out there are not compatible with each other.

You can only encrypt and decrypt using this python lib, as it's not compatible of any other libs.

huhutm commented 7 years ago

OK, thank you!