积极答复者
在WP8.1 怎么使用C# MD5函数?

问题
答案
-
您好,
在WP8.1或者说在winRT中,您需要使用“HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5)”去创建一个MD5的生成器,具体请参考我的代码:
public static string CreateMD5(string str) { var alg = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5); IBuffer buff = CryptographicBuffer.ConvertStringToBinary(str, BinaryStringEncoding.Utf8); var hashed = alg.HashData(buff); var res = CryptographicBuffer.EncodeToHexString(hashed); return res; }
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 ARM830 2016年2月5日 8:49
全部回复
-
您好,
在WP8.1或者说在winRT中,您需要使用“HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5)”去创建一个MD5的生成器,具体请参考我的代码:
public static string CreateMD5(string str) { var alg = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5); IBuffer buff = CryptographicBuffer.ConvertStringToBinary(str, BinaryStringEncoding.Utf8); var hashed = alg.HashData(buff); var res = CryptographicBuffer.EncodeToHexString(hashed); return res; }
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 ARM830 2016年2月5日 8:49