C# MD5 HASH CRC32 查看器(原创) by wy811007

前阵子弄了个小软件 文件 MD5 HASH CRC32 查看器

第一次发 不太会弄 o(︶︿︶)o 唉!

不多说 直接上图

下面是一些获取方法

 1 //获取md5
2 publicstring getmd5(string path)
3 {
4 FileStream get_file =new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
5 System.Security.Cryptography.MD5CryptoServiceProvider get_md5 =new System.Security.Cryptography.MD5CryptoServiceProvider();
6 byte[] hash_byte = get_md5.ComputeHash(get_file);
7 string md5str = System.BitConverter.ToString(hash_byte);
8 md5str = md5str.Replace("-", "");
9 return md5str;
10 }
11 //获取sha1
12 publicstring getsha1(string path)
13 {
14 FileStream get_file =new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
15 System.Security.Cryptography.SHA1CryptoServiceProvider get_sha1 =new System.Security.Cryptography.SHA1CryptoServiceProvider();
16 byte[] hash_byte = get_sha1.ComputeHash(get_file);
17 string sha1str = System.BitConverter.ToString(hash_byte);
18 sha1str = sha1str.Replace("-", "");
19 return sha1str;
20 }
21 //获取文件大小
22 publiclong getsize(string path)
23 {
24 FileInfo fi =new FileInfo(path);
25 long size;
26 return size = fi.Length; //获得文件的字节数
27 }
28 //获取修改时间
29 publicstring gettime(string path)
30 {
31 FileInfo fi =new FileInfo(path);
32 DateTime dtlw = fi.LastWriteTime;
33 string lwtime = dtlw.ToString("yyyy年MM月dd日 dddd HH:mm:ss");
34 return lwtime;
35 }

点击下载

转载于:https://www.cnblogs.com/wy811007/archive/2011/08/12/MD5-HASH-CRC32.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值