2016-05-04 72 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

相關問題