Here you can find the source of digest(String alg, byte[] plainByte)
public static byte[] digest(String alg, byte[] plainByte) throws NoSuchAlgorithmException
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static byte[] digest(String alg, byte[] plainByte) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(alg); md.update(plainByte);/*from w ww . ja v a 2 s . c o m*/ return md.digest(); } public static byte[] digest(String alg, byte[] plainByte, byte[] key) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(alg); md.update(plainByte); return md.digest(key); } }