Java MD5 String md5(String password)

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

Description

md

License

Apache License

Declaration

public static String md5(String password) 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 password) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("MD5");
        md.update(password.getBytes());/*from   w  w  w  . j  ava 2 s .c o  m*/
        return new BigInteger(1, md.digest()).toString(16);
    }

    public static String md5(String username, String password) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("MD5");
        md.update(username.getBytes());
        md.update(password.getBytes());
        return new BigInteger(1, md.digest()).toString(16);
    }
}

Related

  1. md5(String message)
  2. md5(String orgin)
  3. md5(String pass)
  4. md5(String password)
  5. md5(String password)
  6. md5(String path_of_file_)
  7. MD5(String pData)
  8. md5(String plain)
  9. md5(String plainText)