C# get md5,renamed file and can not change file's md5
using System;
using System.Text;
using System.IO;
using System.Security.Cryptography; namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
string imgPath1 = @"..\..\Images\lj.jpg";
string imgPath2 = @"..\..\Images\lj2.jpg";
string imgPath3 = @"..\..\Images\lj3.jpg";
string imgPath4 = @"..\..\Images\lj4.jpg";
string md51 = GetMD5(imgPath1);
string md52 = GetMD5(imgPath2);
string md53 = GetMD5(imgPath3);
string md54 = GetMD5(imgPath4);
Console.WriteLine($"path:{imgPath1},md51:{md51}");
Console.WriteLine($"path:{imgPath2},md52:{md52}");
Console.WriteLine($"path:{imgPath3},md53:{md53}");
Console.WriteLine($"path:{imgPath4},md54:{md54}");
Console.ReadLine();
} static string GetMD5(string sourceFile)
{
StringBuilder md5Builder = new StringBuilder();
if (File.Exists(sourceFile))
{
using (MD5 md5Hash = MD5.Create())
{
using(FileStream fs=File.Open(sourceFile,FileMode.Open))
{
byte[] md5Bytes = md5Hash.ComputeHash(fs);
for (int i = ; i < md5Bytes.Length; i++)
{
string sortedByte = md5Bytes[i].ToString("x2");
if (!string.IsNullOrEmpty(sortedByte))
{
md5Builder.Append(sortedByte);
}
}
}
}
}
return md5Builder.ToString();
}
}
}
C# get md5,renamed file and can not change file's md5的更多相关文章
- MD5加密解密类(asp.net)&使用MD5过时处理
加密类 #region ========加密======== /// <summary> /// 加密 /// </summary> /// <param name=&q ...
- (转)win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
原文地址:http://www.cnblogs.com/fnng/p/4115607.html 作者:虫师 今天想在在win7 64位环境下使用python 操作mysql 在安装MySQL-pyth ...
- win7 64 安装mysql-python:_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
今天想在在win7 64位环境下使用python 操作mysql 在安装MySQL-python 时报错: _mysql.c _mysql.c(42) : fatal error C1083: Can ...
- IO:File类(java.io.File)
public class File extends Object implements Serializable, Comparable<File> 构造方法: public File(S ...
- error BK1506 : cannot open file '.\Debug\????????.sbr': No such file or dire
http://blog.csdn.net/shuilan0066/article/details/8738035 分类: 调试错误信息2013-03-29 19:08492人阅读 ...
- git “bad index file sha1 signature fatal: index file corrupt”错误
在执行commit或revert等操作时,提示“bad index file sha1 signature fatal: index file corrupt”错误,导致操作失败.这是由于git的in ...
- JAVA FILE or I/O学习 - File学习
public class FileKnow { public static void main(String[] args) { //构建file对象 ,参数表示文件所在的路径 File file = ...
- malformed or corrupted AST file。。。module file out of date'
今天打开了曾经用的一个项目,(曾经的程序是对的)弹出了两个红框 malformed or corrupted AST file...module file out of date'. 这种结构. 解决 ...
- adb pull 报错处理:adb: error: cannot create file/directory 'E:\': No such file or directory
adb pull /sdcard/1.txt e:/ 报错:adb: error: cannot create file/directory 'E:\': No such file or direct ...
随机推荐
- 2019-10-16:maccms10后门复现利用,解析
该文章仅供学习,利用方法来自网络文章,仅供参考 Maccms10基于php+mysql的maccms,是苹果的内容管理,方便使用,功能良好,适用范围广 后门网站下载网址,是假官网:http://www ...
- 打算写一个《重学Node.js》系列,希望大家多多支持
先放上链接吧,项目已经开始2周了:https://github.com/hellozhangran/happy-egg-server 想法 现在是2019年11月24日,还有人要开始学习Node.js ...
- Python的import机制
模块与包 在了解 import 之前,有两个概念必须提一下: 模块: 一个 .py 文件就是一个模块(module) 包: __init__.py 文件所在目录就是包(package) 当然,这只是极 ...
- linux下的du和df的区别
du(disk usage)是通过搜索文件来计算每个文件的大小然后累加,du能看到的文件只是一些当前存在的,没有被删除的.他计算的大小就是当前他认为存在的所有文件大小的累加和. df(disk fre ...
- [书籍]值得纪念的第100篇博客,推荐一些看过的UI书籍
1. 前言 来到博客园11年,这两年闲下来了才有时间写写博客,不知不觉终于写到第100篇博客了.回顾过去发表的博客,居然大部分都与UI相关.明明我本来从事的是Oracle的相关开发,明明我当初的目标是 ...
- Linux 基本命令操作 (文件共享) 一
前言:在学习Linux过程中,遇到一些经典而又基本的命令操作,想记录下来去帮助刚学Linux的同学.下面是有关相关的操作,我会进行详细的分解步骤:希望能够帮助到你们.由于时间仓促,再加上笔者的能力有限 ...
- linux 系统自动定制运行 crontab
在UNIX下怎样实现和Windows下“计划任务”一样的功能 $crontab -e 编辑脚本 $crontab -l 察看脚本 用$crontab -e 编辑脚本,加入下列行 :分 小时 星期 ...
- Python内置类属性,元类研究
Python内置类属性 我觉得一切都是对象,对象和元类对象,类对象其实都是一样的,我在最后进行了证明,但是只能证明一半,最后由于元类的父类是type,他可以阻挡对object属性的访问,告终 __di ...
- ImSQL:海量数据,可信存储
数据造假.数据不可信等问题的存在,给金融监管及风控等众多应用场景带来了严峻的挑战,也正成为阻碍数据大规模互联互通.共享共用的一大障碍.数据的真实可信问题长期影响着社会的各个领域,在更依赖数据的人工智能 ...
- Android实现图片一边的三角形边框
在每一个图片的某一侧都可以展示出一个三角形的边框视图,就是咱们的三角形标签视图.这个视图在电商类APP当中比较常用,使用过ebay的同学应该都还记得有些商品的左上角或者右上角都会显示一个三角形的边框, ...