Here you can find the source of digest(String input, String algorithm, String encoding)
private static byte[] digest(String input, String algorithm, String encoding) throws Exception
//package com.java2s; import java.security.MessageDigest; public class Main { private static byte[] digest(String input, String algorithm, String encoding) throws Exception { MessageDigest messageDigest = MessageDigest.getInstance(algorithm); return messageDigest.digest(input.getBytes(encoding)); }/*from w w w .j a va2 s . c o m*/ }