Java MD5 String md5(String value)

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

Description

md

License

Open Source License

Declaration

public final static String md5(String value) 

Method Source Code


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

import java.security.MessageDigest;

public class Main {
    public final static String md5(String value) {
        if (value == null)
            value = "";
        try {//from   ww  w  . ja v a 2 s  .  co m
            final MessageDigest digest = MessageDigest.getInstance("MD5");
            final byte[] buffer = value.getBytes("UTF-8");
            final byte[] digestBuffer = digest.digest(buffer);
            return new String(digestBuffer);
        } catch (final Exception e) {
            return null;
        }
    }
}

Related

  1. md5(String text, String charset)
  2. md5(String text, String key)
  3. md5(String txt)
  4. md5(String userPass)
  5. md5(String value)
  6. md5(String value)
  7. md5(String value)
  8. md5(String... args)
  9. MD5(String... texts)