Here you can find the source of sha1Hex(byte[] bytes)
@Deprecated public static String sha1Hex(byte[] bytes)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; public class Main { /**/*from ww w . j a v a 2 s .co m*/ * @deprecated moved to HashFunctions */ @Deprecated public static String sha1Hex(byte[] bytes) { return toHex(sha1(bytes)); } public static String toHex(byte[] bytes) { StringBuffer hexString = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { // could use a for loop, but we're only dealing with a single byte hexString.append('0'); } hexString.append(hex); } return hexString.toString(); } /** * returns a 20 byte sha1 hash * @param bytes * @return * @deprecated moved to HashFunctions */ @Deprecated public static byte[] sha1(byte[] bytes) { try { MessageDigest sha = MessageDigest.getInstance("SHA-1"); byte[] result = sha.digest(bytes); return result; } catch (Exception x) { } return null; } }