Java MD5 String MD5ToInt(String s)

Here you can find the source of MD5ToInt(String s)

Description

MD To Int

License

Open Source License

Declaration

public static int MD5ToInt(String s) 

Method Source Code

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

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

public class Main {
    public static int MD5ToInt(String s) {
        byte[] digest = MD5(s);
        BigInteger bigInt = new BigInteger(1, digest);
        return bigInt.intValue();
    }//from   w ww . j  av  a 2 s .  co m

    private static byte[] MD5(String s) {
        MessageDigest m = null;
        try {
            m = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        m.reset();
        m.update(s.getBytes());
        return m.digest();
    }
}

Related

  1. md5String(String paramString)
  2. md5String(String s)
  3. md5String(String s)
  4. MD5String(String str)
  5. MD5StringToL32(String md5Str)
  6. md5Util(String password)