RunKit + npm:

node v8.11.1
version: 1.0.0
endpointsharetweet
let CryptoJS = require('crypto-js'); function encrypt(keyword, nonce) { let encrypted_password_bytes = CryptoJS.AES.encrypt(keyword, nonce); let encrypted_password_string = encrypted_password_bytes.toString(); return encrypted_password_string; } function decrypt(keyword, nonce) { var decrypted_password_bytes = CryptoJS.AES.decrypt(keyword, nonce); var decrypted_password_string = decrypted_password_bytes.toString(CryptoJS.enc.Utf8); return decrypted_password_string; } /* Example: keyword = "p@ssw0rd" encrypted_keyword = "U2FsdGVkX19Di0gStlndsMVdFQzsvjM/06ZtqwvQhGI="; */ var encrypted_keyword = encrypt('p@ssw0rd' , '151395403713500'); var decrypted_keyword = decrypt(encrypted_keyword, '151395403713500');
Created from: https://npm.runkit.com/
Loading…

no comments

    sign in to comment