all-encrypt-decrypt v2.0.1
encryption techniques with one line of code
Please check follwing example
install the repository by following command
npm i all-encrypt-decrypt
actual coding
const { Encoding, Decoding } = require('all-encrypt-decrypt');
//Base64 Encrypt & Decrypt
const a = Encoding("base64", "this is rravindra 123");
console.log("a ==> ", a);
const b = Decoding("base64", "dGhpcyBpcyBycmF2aW5kcmEgMTIz");
console.log("b ==> ",b);
//AES Encrypt & Decrypt
const c = Encoding("AES", "this is rravindra 123", {key: "myRrAvIndra"});
console.log("c ==> ",c);
const d = Decoding("AES", "U2FsdGVkX1+6vtVkb2Ao0YI8Y7gC8ggKqSsUuNFlRJs0YeGBKo2EPgdo7JyWdgr2", {key: "myRrAvIndra"});
console.log("d ==> ",d);
//MD5 Encrypt
const e = Encoding("MD5", "this is rravindra 123");
console.log("e ==> ",e);
Output will be as follow :
a ==> { value: 'dGhpcyBpcyBycmF2aW5kcmEgMTIz', success: true }
b ==> { value: 'this is rravindra 123', success: true }
c ==> { value: 'U2FsdGVkX1/sjHtAIsVoEjDBemMJSQzJv52z/IJqqUlP7kL/wgZi9Ns6BMheOnYS', success: true }
d ==> { value: 'this is rravindra 123', success: true }
e ==> { value: 'dcd0cb71226f047b1ced5a9035b1d564', success: true }
Notes :
Basic structure is having two parameters first is type of encoding or decoding(AES, MD5, base64) and second is text(string for encoding, crypted string for decoding).
Whenever success of response getting false then check errMessage for error description.
Note: Object cant be decrypted in this plugin