快速使用Romanysoft LAB的技术实现 HTML 开发Mac OS App,并销售到苹果应用商店中。《HTML开发Mac OS App 视频教程》
- 土豆网同步更新:http://www.tudou.com/plcover/VHNh6ZopQ4E/
- 百度网盘同步:http://pan.baidu.com/s/1jG1Q58M
- 分享 [中文纪录片]互联网时代 http://pan.baidu.com/s/1qWkJfcS
官方QQ群:(申请加入,说是我推荐的)
Step1:引入库
1 using System.Security.Cryptography;
2 using System.IO;
Step2: 计算字符串的Md5值
1 static public string GetMD5WithString(string sDataIn)
2 {
3 string str = "";
4 byte[] data = Encoding.GetEncoding("utf-8").GetBytes(str);
5 MD5 md5 = new MD5CryptoServiceProvider();
6 byte[] bytes = md5.ComputeHash(data);
7 for (int i = 0; i < bytes.Length; i++)
8 {
9 str += bytes[i].ToString("x2");
10 }
11 return str;
12 }
Step3:计算文件的Md5值
1 static public string GetMD5WithFilePath(string filePath)
2 {
3 FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
4 MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
5 byte[] hash_byte = md5.ComputeHash(file);
6 string str = System.BitConverter.ToString(hash_byte);
7 str = str.Replace("-", "");
8 return str;
9 }