Java MD5 md5(String source)

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

Description

md

License

Open Source License

Declaration

public static String md5(String source) 

Method Source Code


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

import javax.xml.bind.DatatypeConverter;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Main {
    public static String md5(String source) {
        byte[] bytes;
        try {//  www  .j  a va  2s.  c o  m
            bytes = MessageDigest.getInstance("MD5").digest(source.getBytes("UTF-8"));
        } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
            return null;
        }
        return DatatypeConverter.printHexBinary(bytes).toLowerCase();
    }
}

Related

  1. isEtagAlsoAnMD5Hash(String etag)
  2. looksLikeValidMd5(String possibleMd5)
  3. md5(File f)
  4. md5(final String text)
  5. md5(final String... tokens)
  6. md5(String toDigest)
  7. md5_hh(int C, int B, int G, int F, int A, int E, int D)
  8. md5_id(byte[] md5digest)
  9. md5bytesToHex(byte[] md5)