PHP Classes

File: api5/api5/js/cryptojs-aes/aes-json-format.js

Recommend this page to a friend!
  Classes of Santo Nuzzolillo   API SQL to JSON   api5/api5/js/cryptojs-aes/aes-json-format.js   Download  
File: api5/api5/js/cryptojs-aes/aes-json-format.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: API SQL to JSON
Send AJAX requests and responding with JSON data
Author: By
Last change:
Date: 6 years ago
Size: 797 bytes
 

Contents

Class file image Download
/** * AES JSON formatter for CryptoJS * * @author BrainFooLong (bfldev.com) * @link https://github.com/brainfoolong/cryptojs-aes-php */ var CryptoJSAesJson = { stringify: function (cipherParams) { var j = {ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64)}; if (cipherParams.iv) j.iv = cipherParams.iv.toString(); if (cipherParams.salt) j.s = cipherParams.salt.toString(); return JSON.stringify(j); }, parse: function (jsonStr) { var j = JSON.parse(jsonStr); var cipherParams = CryptoJS.lib.CipherParams.create({ciphertext: CryptoJS.enc.Base64.parse(j.ct)}); if (j.iv) cipherParams.iv = CryptoJS.enc.Hex.parse(j.iv); if (j.s) cipherParams.salt = CryptoJS.enc.Hex.parse(j.s); return cipherParams; } }