Here you can find the source of sha1(final byte[] bytes)
public static byte[] sha1(final byte[] bytes)
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /** Gets the given byte array's SHA-1 checksum, or null if unavailable. */ public static byte[] sha1(final byte[] bytes) { return digest("SHA-1", bytes); }// ww w . jav a 2 s . c o m /** * Gets the given byte array's hash value according to the specified * algorithm. * * @param algorithm The algorithm to use when generating the hash value. * @param bytes The byte array for which to compute the hash value. * @return The computed hash value, or null if the digest algorithm is not * available. * @see MessageDigest */ public static byte[] digest(final String algorithm, final byte[] bytes) { try { final MessageDigest digest = MessageDigest.getInstance(algorithm); digest.update(bytes); return digest.digest(); } catch (final NoSuchAlgorithmException exc) { return null; } } }