Java MD5 String md5(final String text)

Here you can find the source of md5(final String text)

Description

md

License

Apache License

Declaration

public static String md5(final String text) 

Method Source Code

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

import java.security.MessageDigest;

public class Main {
    public static String md5(final String text) {

        try {//from ww w.  j  a v a  2s .c o  m
            final byte[] bytesOfMessage = text.getBytes("UTF-8");
            final MessageDigest md = MessageDigest.getInstance("MD5");
            final byte[] digest = md.digest(bytesOfMessage);

            return new String(digest);
        } catch (Exception e) {
            throw new RuntimeException();
        }
    }
}

Related

  1. md5(final String s)
  2. md5(final String s)
  3. md5(final String str)
  4. md5(final String string)
  5. md5(final String string)
  6. md5(InputStream input)
  7. md5(InputStream is)
  8. md5(java.lang.String message)
  9. md5(Object content)