xxtea / xxtea-nodejs

XXTEA for encryption algorithm library Node.js
MIT License
57 stars 30 forks source link

Add optional parameter includeLength to encrypt/decrypt functions, to add possibility encrypt/decrypt values without length #5

Open EgzoT opened 2 years ago

andot commented 2 years ago

Without length, the decrypt text is not correct if the encrypt data length is not a multiple of 4.

EgzoT commented 2 years ago

Without length, the decrypt text is not correct if the encrypt data length is not a multiple of 4.

Yes, I only tested for multiples of 4. But I didn't use this for text but for Buffer data converted to Uint8Array (data from bluetooth device). So, what's the best way to convert Buffer data using these methods?

andot commented 2 years ago

You don't need to modify anything. Just call encrypt and decrypt directly with Uint8Array arguments.