Tools

WorldFirst issues a list of simple, flexible, and effective tools to enhance your development, integration and testing process. Utilize these tools to make your experience with WorldFirst solutions as smooth and efficient as possible.

MD5 utility

MD5 Utility is a set of tool in Java that calculates and verifies MD5 hashes. You can use MD5 algorithm in any preferred programming language to encrypt and verify the signature while creating a redirection URL.

Sample using Java

copy
package com.alipay.iopentools;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
 * MD5 encryption/authentication tool class
 */
public class MD5Utils1 {
    /**
     * String encrypted to MD5 without salt
     *
     * @param plainText Pass in the string to be encrypted
     * @return Generate 32-bit (lowercase letters + numbers) string after MD5 encryption
     */
    public static String MD5Lower(String plainText) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(plainText.getBytes());
            return new BigInteger(1, md.digest()).toString(16);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * Test
     *
     * @param args
     */
    public static void main(String[] args) {
        String sign_data = "partnerId=*****&extBizPartnerId=*****&redirectUrl=*****&referenceCustomerId=*****&storeUrl=*****&storeName=*****p&currency=USD&requestId=*****&key=*****@***.***";
        String signature = MD5Lower(sign_data);
        System.out.println(signature);
    }
}

Sample using Linux command

copy
echo -n "partnerId=*****&extBizPartnerId=*****&redirectUrl=*****&referenceCustomerId=*****&storeUrl=*****&storeName=*****p&currency=USD&requestId=*****&key=*****@***.***" | md5sum

For more details about creating a redirection URL, refer to the Create a Receiving Account for Customers chapter.