Skip to content Skip to sidebar Skip to footer

Cryptojs No Method Mixin

I am getting the following error in my browser (Chrome): Uncaught TypeError: Object [object global] has no method 'mixIn' aes.js:28 d.CipherParams.l.extend.init aes.js:28 c

Solution 1:

This is an old question but i just ran into same issue. The problem is that the CryptoJS.AES.encrypt method returns an object not a string.

All you need to do is modify your encrypt function as follows:

function encrypt(data, key) {
   return CryptoJS.AES.encrypt(data, key).toString();
}

Likewise, the decrypt function also returns an object so to get the string use:

function decrypt(data, key) {
   return CryptoJS.AES.decrypt(data, key).toString(CryptoJS.enc.Utf8);
}

Post a Comment for "Cryptojs No Method Mixin"