| |
e207. Creating a Keyed Digest Using MD5
A keyed digest is one in which a secret key is used to create
a digest for a buffer of bytes. You can use different keys to
create different digests for the same buffer of bytes.
public static byte[] getKeyedDigest(byte[] buffer, byte[] key) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(buffer);
return md5.digest(key);
} catch (NoSuchAlgorithmException e) {
}
return null;
}
e206.
Listing All Available Message Digest Algorithms
© 2002 Addison-Wesley.
|