Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: Cannot read property '0' of undefined CryptoJS

I am using CryptoJS and I keep getting Uncaught TypeError. Basically, when I try to send the message an encrypt it, that is when I end up getting the error.

The error I am getting is within the cryptoJS package. Line 256 starts at var encrypted = CryptoJS.AES.encrypt(myString, myPassword);

I am assuming the issue is within the piece of code I have listed below, or there it is when I have been importing the package.

enter image description here

    var myString = messageInput.value;
    var myPassword = 11111;
    var encrypted = CryptoJS.AES.encrypt(myString, myPassword);
like image 775
Zubair Amjad Avatar asked Sep 06 '25 16:09

Zubair Amjad


1 Answers

Answer written from comments in OP.

Password be a string not a number. Rather than entering "11111" to test try "testpassword".


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!