Guest User

Untitled

a guest
Jan 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. public static String checksum(File file) throws IOException, NoSuchAlgorithmException {
  2. MessageDigest digest = MessageDigest.getInstance("SHA-256");
  3. BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
  4. byte[] buff = new byte[bis.available()];
  5. bis.read(buff, 0, buff.length);
  6. byte[] hash = digest.digest(buff);
  7. return new BASE64Encoder().encode(hash);
  8. }
Add Comment
Please, Sign In to add comment