Here you can find the source of digest(byte[] bytes)
public static String digest(byte[] bytes) throws NoSuchAlgorithmException
//package com.java2s; //License from project: LGPL import sun.misc.BASE64Encoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String digest(byte[] bytes) throws NoSuchAlgorithmException { MessageDigest sha = MessageDigest.getInstance("SHA"); byte[] digest = sha.digest(bytes); BASE64Encoder base64Encoder = new BASE64Encoder(); return base64Encoder.encode(digest); }/*from w ww .j a v a 2 s .c o m*/ }