Package net.targetr.wtm3.io
Class DigestUtil
java.lang.Object
net.targetr.wtm3.io.DigestUtil
Tools for processing hashes.
- Author:
- Dr Michael Gardiner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbytesToHex(byte[] bytes) Converts a byte array to a text string of HEX.static byte[]Converts string of hex into byte array.static Stringmd5(byte[] data) Generates a text MD5 from an array of bytes.static byte[]md5Bytes(byte[] data) Generates a byte array MD5 from an array of bytes.
-
Constructor Details
-
DigestUtil
public DigestUtil()
-
-
Method Details
-
md5
Generates a text MD5 from an array of bytes.- Parameters:
data- source data to create MD5 from.- Returns:
- the string MD5 of data.
-
md5Bytes
public static byte[] md5Bytes(byte[] data) Generates a byte array MD5 from an array of bytes.- Parameters:
data- source data to create MD5 from.- Returns:
- the byte array MD5 of data.
-
bytesToHex
Converts a byte array to a text string of HEX.- Parameters:
bytes- to convert to HEX.- Returns:
- the string HEX version of the bytes.
-
hexStringToByteArray
Converts string of hex into byte array.- Parameters:
hex- the HEX string to convert.- Returns:
- byte array created from HEX.
-