admin管理员组文章数量:1410682
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.
var myString = messageInput.value;
var myPassword = 11111;
var encrypted = CryptoJS.AES.encrypt(myString, myPassword);
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.
var myString = messageInput.value;
var myPassword = 11111;
var encrypted = CryptoJS.AES.encrypt(myString, myPassword);
Share
edited Jun 22, 2018 at 2:54
Tibrogargan
4,6133 gold badges20 silver badges40 bronze badges
asked Jun 22, 2018 at 2:18
Zubair AmjadZubair Amjad
7711 gold badge13 silver badges30 bronze badges
4
- This code is not runnable as-is and you don't explain where you're getting the error. How exactly do you expect to get help with this? Please provide an minimal reproducible example – Tibrogargan Commented Jun 22, 2018 at 2:25
-
2
try
var myPassword = "11111";
– Jaromanda X Commented Jun 22, 2018 at 2:33 -
1
Your plain text must be a
string
, notnumber
. – Justinus Hermawan Commented Jun 22, 2018 at 2:38 - Ahhhhh thank you it worked! I changed it to a string and its good to go! – Zubair Amjad Commented Jun 22, 2018 at 2:46
1 Answer
Reset to default 4Answer written from ments in OP.
Password be a string not a number. Rather than entering "11111" to test try "testpassword".
本文标签: javascriptUncaught TypeError Cannot read property 39039 of undefined CryptoJSStack Overflow
版权声明:本文标题:javascript - Uncaught TypeError: Cannot read property '0' of undefined CryptoJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744952637a2634169.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论