Here you can find the source of getHash(String pass, String algorithm)
private static byte[] getHash(String pass, String algorithm) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { private static byte[] getHash(String pass, String algorithm) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest.getInstance(algorithm); md.update(pass.getBytes());// www. j a va2s . c o m byte[] hash = md.digest(); return hash; } }