×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: M. Chris
Added: Apr 16, 2019 8:46 AM
Views: 3819
Tags: no tags
  1. package com.mkyong.hashing;
  2.  
  3. import org.apache.commons.codec.digest.DigestUtils;
  4.  
  5. import java.io.FileInputStream;
  6. import java.io.IOException;
  7.  
  8. public class App {
  9.  
  10.     public static void main(String[] args) throws IOException {
  11.  
  12.         String checksumSHA256 = DigestUtils.sha256Hex(new FileInputStream("d:\\server.log"));
  13.         System.out.println("checksumSHA256 : " + checksumSHA256);
  14.  
  15.         String checksumMD5 = DigestUtils.md5Hex(new FileInputStream("d:\\server.log"));
  16.         System.out.println("checksumMD5 : " + checksumMD5);
  17.  
  18.     }
  19.        
  20. }