Here you can find the source of getHashBase64(String origStr, String digestAlgorithm)
public static String getHashBase64(String origStr, String digestAlgorithm) throws NoSuchAlgorithmException
//package com.java2s; /**//from w w w . j a v a2 s. co m * License: https://github.com/votingsystem/votingsystem/wiki/Licencia */ import javax.xml.bind.DatatypeConverter; import java.security.*; public class Main { public static String getHashBase64(String origStr, String digestAlgorithm) throws NoSuchAlgorithmException { MessageDigest sha = MessageDigest.getInstance(digestAlgorithm); byte[] resultDigest = sha.digest(origStr.getBytes()); return DatatypeConverter.printBase64Binary(resultDigest); } }