Skip to content

Instantly share code, notes, and snippets.

@micmath
Created November 15, 2019 10:58
Show Gist options
  • Save micmath/27b587f6143a6152d50e70ea4cc52cc1 to your computer and use it in GitHub Desktop.
Save micmath/27b587f6143a6152d50e70ea4cc52cc1 to your computer and use it in GitHub Desktop.
var simpleCryptoJs = require("simple-crypto-js").default;
var secret = "FAKE-EXAMPLE-5rV4e!Wvso8%Yhbsq&*j639$7kys";
var simpleCrypto = new simpleCryptoJs(secret);
var plainText = "Hello Squirrel!";
var cipherText = simpleCrypto.encrypt(plainText);
var decipherText = simpleCrypto.decrypt(cipherText);
console.log("Plain Text : " + plainText);
console.log("Cipher Text : " + cipherText);
console.log("Decipher Text : " + decipherText);
//=> "Plain Text : Hello Squirrel!"
//=> "Cipher Text : 51bfd1092b6ce1226a7786f7d39a70ab3e557f8d563edb7dc72f8c5867d1964a4tk9OCFLjYNhTGiXJUIJ0g=="
//=> "Decipher Text : Hello Squirrel!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment