Here you can find the source of md5(byte[] data)
Parameter | Description |
---|---|
data | the data |
public static byte[] md5(byte[] data)
//package com.java2s; //License from project: Open Source License import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Main { /**//from w ww .j a v a 2 s. c o m * Calculate the md5 hash value of a byte array * * @param data * the data * @return the calculated hash as a 16 byte array */ public static byte[] md5(byte[] data) { byte[] md5; // Calculate MD5 try { MessageDigest md5Digest = MessageDigest.getInstance("MD5"); md5Digest.update(data, 0, data.length); md5 = md5Digest.digest(); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Couldn't generate MD5, not supported!"); } return md5; } }