Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class MD5 extends Object
| Constructor and Description |
|---|
MD5()
Class constructor
|
MD5(Object ob)
Initialize class, and update hash with ob.toString()
|
| Modifier and Type | Method and Description |
|---|---|
String |
asHex()
Returns 32-character hex representation of this objects hash
|
static String |
asHex(byte[] hash)
Turns array of bytes into string representing each byte as
unsigned hex number.
|
byte[] |
Final()
Returns array of bytes (16 bytes) representing hash as of the
current state of this object.
|
static long |
getMD5Hi(byte[] md5) |
static long |
getMD5Hi(String md5) |
static long |
getMD5Lo(byte[] md5) |
static long |
getMD5Lo(String md5) |
static String |
getMD5String(long md5_hi,
long md5_lo) |
void |
Init()
Initialize MD5 internal state (object can be reused just by
calling Init() after every Final()
|
void |
Update(byte b)
Updates hash with a single byte
|
void |
Update(byte[] buffer)
Updates hash with given array of bytes
|
void |
Update(byte[] buffer,
int length) |
void |
Update(byte[] buffer,
int offset,
int length)
Plain update, updates this object
|
void |
Update(int i)
Update buffer with a single integer (only & 0xff part is used,
as a byte)
|
void |
Update(String s)
Update buffer with given string.
|
public MD5()
public MD5(Object ob)
ob - Object, ob.toString() is used to update hash
after initializationpublic final void Init()
public void Update(byte[] buffer,
int offset,
int length)
public void Update(byte[] buffer,
int length)
public void Update(byte[] buffer)
buffer - Array of bytes to use for updating the hashpublic void Update(byte b)
b - Single byte to update the hashpublic final void Update(String s)
s - String to be update to hash (is used as
s.getBytes())public void Update(int i)
i - Integer value, which is then converted to
byte as i & 0xffpublic byte[] Final()
public static String asHex(byte[] hash)
hash - Array of bytes to convert to hex-stringpublic String asHex()
public static String getMD5String(long md5_hi, long md5_lo)
public static long getMD5Hi(byte[] md5)
public static long getMD5Hi(String md5) throws IllegalArgumentException
IllegalArgumentExceptionpublic static long getMD5Lo(byte[] md5)
public static long getMD5Lo(String md5) throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2000–2016 AO Industries, Inc.. All rights reserved.