Java MD5 Byte Array MD5Raw(byte[] src)

Here you can find the source of MD5Raw(byte[] src)

Description

MD Raw

License

Open Source License

Declaration

public static byte[] MD5Raw(byte[] src) 

Method Source Code

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

import java.security.*;

public class Main {
    private static final ThreadLocal<MessageDigest> md5 = new ThreadLocal<MessageDigest>() {
        @Override//from  w  w w. ja  va 2s .com
        protected MessageDigest initialValue() {
            MessageDigest crypt = null;
            try {
                crypt = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException e) {
                e.printStackTrace();
            }
            return crypt;
        }
    };

    public static byte[] MD5Raw(byte[] src) {
        MessageDigest crypt = md5.get();
        crypt.reset();
        crypt.update(src);
        return crypt.digest();
    }
}

Related

  1. md5Digest(byte[] bytes)
  2. md5Hex(byte data[])
  3. md5Hex(byte[] data)
  4. md5key(byte[] key)
  5. md5P(final ByteBuffer bb)