public bool hmac_md5( string timespan, password,255);">ref outdigest)
... {
byte[] b_tmp;
[] b_tmp1;
string szRet = .Empty;
if (password ==null|| password.Length <1)
...{
returnfalse;
}
[] digest new[512];
[] k_ipad 64[] k_opad [] source System.Text.ASCIIEnCoding.ASCII.GetBytes(password);
System.Security.Cryptography.MD5 shainner
MD5CryptoServiceProvIDer();for (int i 0; i ; i++)
...{
k_ipad[i]
^0x36;k_opad[i]
0x5ctry... (source.Length >)
...{
shainner
MD5CryptoServiceProvIDer();source
shainner.ComputeHash(source);}
source.Length; i)
...{
k_ipad[i]
)(source[i] );k_opad[i]
);}
b_tmp1
System.Text.ASCIIEnCoding.ASCII.GetBytes(timespan);b_tmp
adding(k_ipad, b_tmp1);shainner
MD5CryptoServiceProvIDer();digest
shainner.ComputeHash(b_tmp);b_tmp
adding(k_opad, digest);shainner
shainner.ComputeHash(b_tmp);// for (int i = 0; i < digest.Length; i++)
{
outdigest System.Text.ASCIIEnCoding.ASCII.GetString(digest);[i].ToString();
} truecatch (Exception e)
...{
outdigest
e.Message.ToString();
}
/**/ /***
* * 填充byte
**
*/byte [] adding( [] a,0);">[] b)
@H_720_419@ ... [] c [a.Length + b.Length];
a.copyTo(c,
); b.copyTo(c, a.Length);
c;
}
总结以上是内存溢出为你收集整理的C# 输入输出均为string的HMAC-MD5全部内容,希望文章能够帮你解决C# 输入输出均为string的HMAC-MD5所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)