Search code examples
javascriptnode.jsencryptionaescryptojs

how to decrypt the below encryption in CryptoJS?


i have the below encryption code on javascript and how can i decrypt the same in javascript? I am new to encryption/decryption and need someone help to decrypt the method. thanks in advance.

   var text = "The quick brown fox jumps over the lazy dog. 👻 👻";
    var secret = "René Über";
    var encrypted = CryptoJS.AES.encrypt(text, secret);
    encrypted = encrypted.toString();
    console.log("Cipher text: " + encrypted);

Solution

  • Like this?

    let decr = CryptoJS.AES.decrypt(encrypted, secret);
    decr = decr.toString(CryptoJS.enc.Utf8);
    console.log("Decrypted: ", decr);