public static String hash(String hash,String algo) throws NoSuchAlgorithmException, UnsupportedEncodingException {
  MessageDigest md=MessageDigest.getInstance(algo);
  byte[] data=hash.getBytes("UTF-8");
  md.update(data,0,data.length);
  return hex(md.digest());
}

public static String hash ( String hash , String algo ) throws NoSuchAlgorithmException , UnsupportedEncodingException { MessageDigest md = MessageDigest . getInstance ( algo ) ; byte [ ] data = hash . getBytes ( "UTF-8" ) ; md . update ( data , 0 , data . length ) ; return hex ( md . digest ( ) ) ; }
hash string to hex .
