2016-05-04 31 views
-1

任何人都可以告诉我CryptoJS.AES.encrypt函数(消息,密码)中这两个参数的含义是什么?我可以只加入一个参数,我想要加密的密码的参数?CryptoJs.AES函数的参数是什么意思?

例如:

CryptoJS.AES.encrypt(消息,密码);

谢谢!

回答

0

我对CryptoJS没有任何经验,但经过快速搜索,我找到了以下内容。

message参数是您要加密的文本。 当您想要解密消息时,需要password参数。

示例代码:

var secretMessage = "Hello World!"; 

// Encrypt our secret message. 
var encrypted = CryptoJS.AES.encrypt(secretMessage, "Secret Passphrase"); 

// Decrypt our message. 
var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase"); 

// Since the decrypted message is a Base64 string, to read the message we first need to convert it. 
var message = decrypted.toString(CryptoJS.enc.Utf8); // Hello World! 

Here's我发现的文章。

希望这有助于

+0

感谢很多:) – Reollyn

+0

没问题:)不过既然这个问题帮你,你可以将其标记为答案吗?只是这样它才不会出现在没有回答的问题列表中。 –

+0

如何将其标记为答案? – Reollyn

相关问题