Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String checksum(File file) throws IOException, NoSuchAlgorithmException {
- MessageDigest digest = MessageDigest.getInstance("SHA-256");
- BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
- byte[] buff = new byte[bis.available()];
- bis.read(buff, 0, buff.length);
- byte[] hash = digest.digest(buff);
- return new BASE64Encoder().encode(hash);
- }
Add Comment
Please, Sign In to add comment