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 }

点击下载

posted @ 2011-08-12 15:38  wy811007  阅读(1077)  评论(0编辑  收藏  举报

Powered by: 博客园 Copyright © wy811007