Java MD5 Compare compareMD5(String md5a, String md5b)

Here you can find the source of compareMD5(String md5a, String md5b)

Description

compare MD

License

Open Source License

Declaration

public final static boolean compareMD5(String md5a, String md5b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public final static boolean compareMD5(String md5a, String md5b) {
        if ((!isValidMD5(md5a)) || (!isValidMD5(md5b))) {
            return false;
        }/*  w w w. j a  v  a 2s  .c  om*/

        return md5a.equalsIgnoreCase(md5b);
    }

    private static boolean isValidMD5(String md5) {
        if (md5 == null) {
            return false;
        }

        // Check length AND characters
        return md5.matches("^[0-9A-Fa-f]{32}+$");
    }
}

Related

  1. compareMD5(byte[] m1, byte[] m2)
  2. computeMd5Hash(byte[] arg1)