public static class MD5InputStreamTest.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 byte[] |
getHash(File f) |
static boolean |
hashesEqual(byte[] hash1,
byte[] hash2) |
void |
Init()
Initialize MD5 internal state (object can be reused just by
calling Init() after every Final()
|
static void |
initNativeLibrary(boolean disallow_lib_loading) |
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) |
void |
Update(int i) |
void |
Update(org.nuiton.util.MD5InputStreamTest.MD5State stat,
byte[] buffer,
int offset,
int length)
Updates hash with the bytebuffer given (using at maximum length bytes from
that buffer)
|
void |
Update(String s)
Update buffer with given string.
|
void |
Update(String s,
String charset_name)
Update buffer with given string using the given encoding.
|
public MD5()
public MD5(Object ob)
ob
- Object, ob.toString() is used to update hash
after initializationpublic void Init()
public void Update(org.nuiton.util.MD5InputStreamTest.MD5State stat, byte[] buffer, int offset, int length)
stat
- Which state is updatedbuffer
- Array of bytes to be hashedoffset
- Offset to buffer arraylength
- Use at maximum `length' bytes (absolute
maximum is buffer.length)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 void Update(String s)
s
- String to be update to hash (is used as s.getBytes())public void Update(String s, String charset_name) throws UnsupportedEncodingException
s
- String to be update to hash (is used as
s.getBytes(charset_name))charset_name
- The character set to use to convert s to a
byte array, or null if the "ISO8859_1"
character set is desired.UnsupportedEncodingException
- If the named
charset is not supported.public void Update(int i)
public byte[] Final()
public static String asHex(byte[] hash)
hash
- Array of bytes to convert to hex-stringpublic String asHex()
public static final void initNativeLibrary(boolean disallow_lib_loading)
public static byte[] getHash(File f) throws IOException
IOException
public static boolean hashesEqual(byte[] hash1, byte[] hash2)
Copyright © 2004–2020 CodeLutin. All rights reserved.