Java MD5 Hash md5HashBytesToBytes(byte[] buf)

Here you can find the source of md5HashBytesToBytes(byte[] buf)

Description

md Hash Bytes To Bytes

License

Open Source License

Declaration

public static byte[] md5HashBytesToBytes(byte[] buf) 

Method Source Code

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

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

public class Main {
    public static byte[] md5HashBytesToBytes(byte[] buf) {
        try {//from  w  w w  .j a  v  a  2s. c o  m
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(buf);
            return md.digest();
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }

    public static byte[] md5HashBytesToBytes(byte[] buf, int offset,
            int length) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(buf, offset, length);
            return md.digest();
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. md5Hash(String input)
  2. md5hash(String key)
  3. md5hash(String pass)
  4. md5Hash(String source)
  5. md5Hash(String text)
  6. md5HashInt(String text)