Skip to content Skip to sidebar Skip to footer

Change The Key With Cryptojs

I am using CryptoJS to encrypt and decrypt the text. Here, I am just taking the message and showing the both encryption and decryption messages. I am using DES algorithm for encry

Solution 1:

According to the docs at https://code.google.com/archive/p/crypto-js/#Custom_Key_and_IV, you would need to define and supply both the initialisation vector (IV) and the key if you wish to provide a custom key:

var key = CryptoJS.enc.Hex.parse('000102030405060708090a0b0c0d0e0f'); 
var iv = CryptoJS.enc.Hex.parse('101112131415161718191a1b1c1d1e1f'); 
var encrypted = CryptoJS.AES.encrypt("Message", key, { iv: iv });

Post a Comment for "Change The Key With Cryptojs"