0
要與服務器通信,我需要發送密碼SHA1 & base64編碼方式與CryptoJS相同。爲什麼base64使用CryptoJS與標準的base64編碼不同?
我的問題是,我正在使用VB.NET。典型的base64編碼(UTF-8)結果與CryptoJS的結果不同。
我該如何使用CryptoJS對它進行編碼,以base64對.NET中的SHA1字符串進行編碼?
你可以看到兩個結果在這裏:https://jsfiddle.net/hn5qqLo7/
var helloworld = "Hello World";
var helloword_sha1 = CryptoJS.SHA1(helloworld);
document.write("SHA1: " + helloword_sha1);
var helloword_base64 = helloword_sha1.toString(CryptoJS.enc.Base64);
document.write("1) Base64: " + helloword_base64);
document.write("2) Base64: " + base64_encode(helloword_sha1.toString()));
其中base64_encode
一個給定的字符串到Base 64編碼字符串轉換。
我看到了類似的問題,但我不明白。 Decode a Base64 String using CryptoJS