From 387dc8dea97fc4d880d9a7026d81a76f44279369 Mon Sep 17 00:00:00 2001 From: h0rn3t Date: Tue, 23 Jun 2020 10:35:56 +0300 Subject: [PATCH] use strict, tested on nodejs v10+ --- lib/xxtea.js | 1 + package.json | 10 +++++----- test.js | 8 +++++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/xxtea.js b/lib/xxtea.js index adf9d01..e49747a 100644 --- a/lib/xxtea.js +++ b/lib/xxtea.js @@ -1,3 +1,4 @@ +"use strict" let delta = 0x9E3779B9; diff --git a/package.json b/package.json index 25a3595..e129f97 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "xxtea", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", - "dist-tags": { "latest": "0.2.1" }, - "versions": [ "0.2.1", "0.2.0", "0.1.2", "0.1.1"], - "description": "xxtea encription algorithm in pure javascript", + "dist-tags": { "latest": "0.2.2" }, + "versions": [ "0.2.2","0.2.1", "0.2.0", "0.1.2", "0.1.1"], + "description": "xxtea encryption algorithm in pure javascript", "keywords": [ "encription", "crypt", @@ -25,6 +25,6 @@ "bugs": { "url": "https://github.com/h0rn3t/xxtea/issues" }, - "_id": "xxtea@0.2.1", + "_id": "xxtea@0.2.2", "_from": "xxtea@" } diff --git a/test.js b/test.js index ca9c3df..d35fb2a 100644 --- a/test.js +++ b/test.js @@ -17,4 +17,10 @@ console.log(xxtea.decrypt(data, 'cryptkey')); // => "Привет!" // with Russian + Eng data = xxtea.encrypt('олололо http://русскийтекст', 'cryptkey'); console.log(data); -console.log(xxtea.decrypt(data, 'cryptkey')); // => "Hi!" \ No newline at end of file +console.log(xxtea.decrypt(data, 'cryptkey')); // => "Hi!" + + +// with Russian + Eng + China +data = xxtea.encrypt('олололо http://русскийтекст 试验', 'cryptkeycryptkey'); +console.log(data); +console.log(xxtea.decrypt(data, 'cryptkeycryptkey')); // => "Hi!" \ No newline at end of file