XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for JavaScript.
It is different from the original XXTEA encryption algorithm. It encrypts and decrypts String instead of uint32 Array, and the key is also String.
<!DOCTYPE html>
<html>
<head>
<title>XXTEA test</title>
<meta charset="UTF-8">
<script src="dist/xxtea.min.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
var str = "Hello World! 你好,中国!";
var key = "1234567890";
var encrypt_data = XXTEA.encryptToBase64(str, key);
console.log(encrypt_data);
var decrypt_data = XXTEA.decryptFromBase64(encrypt_data, key);
console.assert(str === decrypt_data);
</script>
</body>
</html>