代码:

public class MD5Test {
public static void main(String[] args) {
String s1 = MD5Test.MD5Operation(new File("E:/a.csv"));
String s2 = MD5Test.MD5Operation(new File("E:/data/a.csv"));
System.out.println(s1.equals(s2));
} public final static String MD5Operation(File file) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
//采用commons-io包的FileUt类的方法,极大地简化了代码。
byte temp[] = FileUtils.readFileToByteArray(file);
md.update(temp);
byte b[] = md.digest();
//采用java.math包的BigInteger类,实现十六进制的转换
BigInteger bigInt = new BigInteger(1, b);
return bigInt.toString(16);
} catch (Exception e) {
return null;
}
}
}

最新文章

  1. [转载]在SQL Server 中,如何实现DBF文件和SQL Server表之间的导入或者导出?
  2. Swift学习--常量.变量.数据类型的使用(一)
  3. ERP客户关系渠管理(二十)
  4. POJ 3176 Cow Bowling (水题DP)
  5. android——仿微拍贷滑动圆形菜单
  6. Css 之 px em %
  7. 调试大叔V1.0.1(2017.09.01)|http/s接口调试、数据分析程序员辅助开发神器
  8. windows 2008 R2操作系统上使用iis服务运行php和mysql数据库的网站遇到的验证码不显示问题?
  9. Python3.x 配置原生虚拟环境
  10. api_request.go
  11. 华为oj之字符个数统计
  12. axf 文件包含太多的调试信息,导致的编译错误
  13. yum源使用的几个报错小总结 (例如: python2.6.6 下yum不能使用: No module named yum)
  14. BZOJ4025 二分图(线段树分治+并查集)
  15. 第 3 章 镜像 - 019 - 使用公共 Registry
  16. 用node.js和webpack做前后端分离的总结
  17. 【AtCoder】ARC086
  18. pandas 的操作表单
  19. python的print()输出
  20. 推荐一个学习Flex chart的好网站

热门文章

  1. mysql5.7.22 zip 版安装
  2. MVC4的缓存
  3. phpexcel图形图表(二)图形
  4. linux命令 — lsof 查看进程打开那些文件 或者 查看文件给那个进程使用
  5. Encourage_by_WeChat
  6. 手机端 html 页面
  7. JSP接口浅析
  8. Unity3D学习笔记——NGUI之Property Binding
  9. Error:指向绑定函数的指针只能用于调用函数
  10. SAP FI 中4个特殊期间