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