Here you can find the source of digestString(String pass, String algorithm)
public static String digestString(String pass, String algorithm) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Apache License import java.io.ByteArrayOutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { public static String digestString(String pass, String algorithm) throws NoSuchAlgorithmException { MessageDigest md;//from w w w. j a v a2 s . c o m ByteArrayOutputStream bos; md = MessageDigest.getInstance(algorithm); byte[] digest = md.digest(pass.getBytes()); return new String(digest); } }