Java MD5 String md5(String s)

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

Description

md

License

Apache License

Declaration

public static String md5(String s) 

Method Source Code

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

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

import sun.misc.BASE64Encoder;

public class Main {
    public static String md5(String s) {
        try {/*from  w  w w  .  j  av  a2  s. co m*/
            MessageDigest md = MessageDigest.getInstance("md5");
            byte b[] = md.digest(s.getBytes());
            return new BASE64Encoder().encode(b);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. MD5(String pwd)
  2. md5(String raw)
  3. md5(String s)
  4. md5(String s)
  5. MD5(String s)
  6. md5(String s)
  7. md5(String s)
  8. md5(String s)
  9. md5(String s)