All Downloads are FREE. Search and download functionalities are using the official Maven repository.

amk.sdk.deeplink.entity.model.Md5Config Maven / Gradle / Ivy

Go to download

The AMK Deeplink SDK is a library for AMK's merchant that allow them to be able generate deeplink for their user to pay via AMK Bank app.

There is a newer version: 1.1.0
Show newest version
package amk.sdk.deeplink.entity.model;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

class Md5Config {
    private static String getHash(String text) {
        MessageDigest m;
        try {
            m = MessageDigest.getInstance("MD5");
            m.reset();
            m.update(text.getBytes());
            byte[] digest = m.digest();
            BigInteger bigInt = new BigInteger(1, digest);
            StringBuilder hashText = new StringBuilder(bigInt.toString(16));
            while (hashText.length() < 32) {
                hashText.insert(0, "0");
            }
            return hashText.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return null;
    }

    static String getDefaultHash(String id) {
        return getHash(id +"|"+ System.currentTimeMillis());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy