|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.extensions.surf.util.MD5
public class MD5
The MD5 utility class computes the MD5 digest (aka: "hash") of a block of data; an MD5 digest is a 32-char ASCII string. The synchronized/static function "Digest" is useful for situations where lock contention in the application is not expected to be an issue. The unsynchronized/non-static method "digest" is useful in a multi-threaded program that wanted to avoid locking by creating an MD5 object for exclusive use by a single thread.
EXAMPLE 1: Static usage import org.springframework.extensions.surf.util.MD5; String x = MD5.Digest("hello".getBytes()); EXAMPLE 2: Per-thread non-static usage import org.springframework.extensions.surf.util.MD5; MD5 md5 = new MD5(); ... String x = md5.digest("hello".getBytes());
Constructor Summary | |
---|---|
MD5()
Constructor for use with the unsynchronized/non-static method "digest" method. |
Method Summary | |
---|---|
String |
digest(byte[] dataToHash)
Non-threadsafe MD5 digest (hashing) function |
static String |
Digest(byte[] dataToHash)
Thread-safe static digest (hashing) function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MD5()
Method Detail |
---|
public static String Digest(byte[] dataToHash)
public String digest(byte[] dataToHash)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |