Android examples for java.security:MD5
Calculate MD5 in Base64 encoding
import android.util.Base64; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main{ public static final String md5base64(byte buffer[]) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(buffer);// ww w .j a v a2 s . c om byte buf2[] = digest.digest(); return Base64.encodeToString(buf2, Base64.NO_WRAP | Base64.NO_PADDING | Base64.NO_CLOSE); } }