Here you can find the source of digest(String type, byte[] bytes)
private static byte[] digest(String type, byte[] bytes)
//package com.java2s; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static byte[] digest(String type, byte[] bytes) { try {/* w w w . j ava 2 s .c o m*/ MessageDigest dist = MessageDigest.getInstance(type); return dist.digest(bytes); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Cannot find digest:" + type, e); } } }