Class java.crypt.MD5
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.crypt.MD5

java.crypt.MessageDigest
   |
   +----java.crypt.MD5

public final class MD5
extends MessageDigest
This class implements the MD5 message digest.

The native code MD5 implementation used by the class was developed by, and is owned by, RSA Data Security, Inc.

Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/) All rights reserved.


Variable Index

 o HASH_LENGTH
This is the length of the final hash (in bytes).

Constructor Index

 o MD5()
The public constructor.

Method Index

 o addToDigest(byte[], int, int)
Add data to the message digest (calls the native code).
 o CreateHash(byte[])
Returns the hash of a single byte array.
 o digest()
Returns the digest of the data added and resets the digest.
 o digestAsHash()
Returns the digest of the data added and resets the digest.
 o hash(byte[])
Returns the hash of a single byte array.
 o hash(String)
Returns the hash of a single string.
 o length()
Return length of the hash (in bytes).
 o reset()
Initialise (reset) the message digest.

Variables

 o HASH_LENGTH
  public final static int HASH_LENGTH
This is the length of the final hash (in bytes).

Constructors

 o MD5
  public MD5()
The public constructor.

Methods

 o length
  public int length()
Return length of the hash (in bytes).
Returns:
The length of the hash.
Overrides:
length in class MessageDigest
See Also:
HASH_LENGTH
 o reset
  public synchronized void reset()
Initialise (reset) the message digest.
Overrides:
reset in class MessageDigest
 o digest
  public synchronized byte[] digest()
Returns the digest of the data added and resets the digest.
Returns:
the digest of all the data added to the message digest as a byte array.
Overrides:
digest in class MessageDigest
 o digestAsHash
  public MessageHash digestAsHash()
Returns the digest of the data added and resets the digest.
Returns:
the digest of all the data added to the message digest as an object.
Overrides:
digestAsHash in class MessageDigest
 o hash
  public static byte[] hash(String msg)
Returns the hash of a single string.
Parameters:
msg - the string to hash.
Returns:
the hash of the string.
 o hash
  public static byte[] hash(byte msg[])
Returns the hash of a single byte array.
Parameters:
msg - the byte array to hash.
Returns:
the hash of the string.
 o CreateHash
  public static HashMD5 CreateHash(byte hash[])
Returns the hash of a single byte array.
Parameters:
msg - the byte array to hash.
Returns:
the hash of the string.
 o addToDigest
  protected synchronized void addToDigest(byte data[],
                                          int offset,
                                          int length)
Add data to the message digest (calls the native code).
Parameters:
data - The data to be added.
offset - The start of the data in the array.
length - The amount of data to add.
Overrides:
addToDigest in class MessageDigest

All Packages  Class Hierarchy  This Package  Previous  Next  Index