• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Extracting Md5 Hash from App

igor0410

Lurker
Hi,

I'm writing a simple program where it scans the installed apks. It returned an apk like: org.myapk.MyApp. Okay, now, I would like to calculate a hash (md5, crc32, sha1, sha256, no matters.. ) from this apk. How can I proceed? Its possible because any antivirus does it.
 
Here is a MD5 snippet you can try:

Code:
private String md5(String in) {
    MessageDigest digest;
    try {
        digest = MessageDigest.getInstance("MD5");
        digest.reset();
        digest.update(in.getBytes());
        byte[] a = digest.digest();
        int len = a.length;
        StringBuilder sb = new StringBuilder(len << 1);
        for (int i = 0; i < len; i++) {
            sb.append(Character.forDigit((a[i] & 0xf0) >> 4, 16));
            sb.append(Character.forDigit(a[i] & 0x0f, 16));
        }
        return sb.toString();
    } catch (NoSuchAlgorithmException e) { e.printStackTrace(); }
    return null;
}

how you can use this function:

Code:
String securepassword = md5(unsecurepassword );

src: link
 
Back
Top Bottom