Java MD5 String md5(String input)

Here you can find the source of md5(String input)

Description

md

License

Apache License

Declaration

public static String md5(String input) throws NoSuchAlgorithmException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigInteger;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static String md5(String input) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] messageDigest = md.digest(input.getBytes());
        BigInteger number = new BigInteger(1, messageDigest);
        String hashtext = number.toString(16);
        while (hashtext.length() < 32) {
            hashtext = "0" + hashtext;
        }/*from   w ww. j  a  va 2  s.  com*/
        return hashtext;
    }
}

Related

  1. md5(String input)
  2. md5(String input)
  3. md5(String Input)
  4. md5(String input)
  5. md5(String input)
  6. md5(String input)
  7. md5(String input)
  8. md5(String input)
  9. md5(String input)