Here you can find the source of digest(String algorithm, String data)
private static byte[] digest(String algorithm, String data)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static byte[] digest(String algorithm, String data) { MessageDigest digest;//from ww w . ja v a 2s . co m try { digest = MessageDigest.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } return digest.digest(data.getBytes()); } }