Here you can find the source of base64Digest(String input)
public static String base64Digest(String input) throws UnsupportedEncodingException, NoSuchAlgorithmException
//package com.java2s; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import android.util.Base64; public class Main { /** First encrypt with SHA1 then convert to Base64*/ public static String base64Digest(String input) throws UnsupportedEncodingException, NoSuchAlgorithmException { String b64digest = convertToBase64(dataDigest(input)); // we trim off last character due to a weird encoding error // Note: check for a solution in the future. return b64digest.substring(0, b64digest.length() - 1); }//ww w .j a v a2 s. co m private static String convertToBase64(byte[] in) throws UnsupportedEncodingException { if (in == null) return null; return new String(Base64.encode(in, Base64.URL_SAFE | Base64.NO_PADDING), "UTF8"); } private static byte[] dataDigest(String in) throws NoSuchAlgorithmException, UnsupportedEncodingException { if (in == null) return null; MessageDigest md = MessageDigest.getInstance("SHA-1"); return md.digest(in.getBytes("UTF8")); } }