Here you can find the source of digestSHA1(byte[] data)
public static byte[] digestSHA1(byte[] data)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static final String ALGORITHM_SHA1 = "SHA1"; public static byte[] digestSHA1(byte[] data) { return digest(data, ALGORITHM_SHA1); }/*w w w. java 2s.com*/ public static byte[] digest(byte[] data, String algorithm) { if (data == null || data.length <= 0) { return null; } try { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(data); return md.digest(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } }