XXTEA for NodeJS
Introduction
XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for NodeJS.
It is different from the original XXTEA encryption algorithm. It encrypts and decrypts Uint8Array instead of uint32[], and the key is also Uint8Array. If you want to encrypt String, you can use xxtea.toBytes(str) to convert String to Uint8Array, when you decrypt Uint8Array, you can use xxtea.toString(bytes) to convert the result to String. Conversion between string and Uint8Array is using UTF8 encoding.
Usage
var XXTea = ;var btoa = ;var atob = ; var passPhrase = 'SomeCrazyPassword!#00';var message = 'Some secert message';console; //constructvar tea = ; //encrypt the message into a byte arrayvar encryptedBytes = tea; //convert to a string and base64 encode itvar encryptedString = ;console; //decode the base64 string and convert back from string to a byte arrayvar encryptedBytes2 = tea; //decryptvar decryptedBytes = tea; //convert the decrypted bytes into a stringvar decryptedString = tea; console;