Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"></script>
- function AESencrypt(str,KEY,IV) {
- key = CryptoJS.enc.Utf8.parse(KEY);
- var iv= CryptoJS.enc.Utf8.parse(IV);
- var encrypted = CryptoJS.AES.encrypt(str, key, {iv:iv, mode: CryptoJS.mode.CBC });
- return encrypted.toString();
- }
- function AESdecrypt(str,KEY,IV) {
- var key = CryptoJS.enc.Utf8.parse(KEY);
- var iv= CryptoJS.enc.Utf8.parse(IV);
- var decrypted = CryptoJS.AES.decrypt(str,key,{iv:iv, mode: CryptoJS.mode.CBC});
- return decrypted.toString(CryptoJS.enc.Utf8);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement