Class cryptix.security.MessageDigest
All Packages Class Hierarchy This Package Previous Next Index
Class cryptix.security.MessageDigest
java.lang.Object
|
+----cryptix.security.MessageDigest
- public class MessageDigest
- extends Object
This is the abstract base class for all message digests.
Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/)
All rights reserved.
- See Also:
- MD5, SHA
-
MessageDigest()
- Both protected and abstract, so this class must be derived
from in order to be useful.
-
add(byte[])
- Add a byte array to the digest
-
add(byte[], int, int)
- Add a section of a byte array to the digest
-
add(String)
- Add the low bytes of a string to the digest (ie.
-
add(String, int, int)
- Add the low bytes of a string to the digest (ie.
-
addToDigest(byte[], int, int)
- Add data to the message digest
This method is protected to ensure that all parameters
are valid at this point - essential if the parameters
are passed to native functions.
-
bitcount()
- Return the number of bits added to the digest so far
-
buf()
-
-
buf_off()
-
-
data_length()
- /**
Return the length (in bytes) of the block that
this hash function operates on.
-
digest()
- Obtain the digest
N.B.
-
digestAsHash()
- Obtain the digest as a Hash object
N.B.
-
hash(byte[], MessageDigest)
- A convenience function for hashing a byte array.
eg:
byte key[] = MessageDigest.hash( bytearray, new MD5() );
-
hash(String, MessageDigest)
- A convenience function for hashing a string.
eg:
byte key[] = MessageDigest.hash( passPhrase, new MD5() );
-
hash_length()
- Return the hash length in bytes
-
length()
- Return the hash length in bytes
-
md_digest()
- Perform the final transformation
-
md_reset()
- Reset the message digest
-
md_transform()
- Perform a transformation
-
name()
- Return the message digest name
-
reset()
- Initialise (reset) the message digest.
MessageDigest
protected MessageDigest()
- Both protected and abstract, so this class must be derived
from in order to be useful.
bitcount
public final long bitcount()
- Return the number of bits added to the digest so far
buf
public final byte[] buf()
buf_off
public final int buf_off()
length
public int length()
- Return the hash length in bytes
hash_length
public abstract int hash_length()
- Return the hash length in bytes
data_length
public abstract int data_length()
- /**
Return the length (in bytes) of the block that
this hash function operates on.
name
public abstract String name()
- Return the message digest name
- Returns:
- The name of the message digest.
reset
public final void reset()
- Initialise (reset) the message digest.
md_reset
protected abstract void md_reset()
- Reset the message digest
md_transform
protected abstract void md_transform()
- Perform a transformation
md_digest
protected abstract byte[] md_digest()
- Perform the final transformation
digest
public final byte[] digest()
- Obtain the digest
N.B. this resets the digest.
- Returns:
- the digest of all the data added to the message digest.
digestAsHash
public abstract MessageHash digestAsHash()
- Obtain the digest as a Hash object
N.B. this resets the digest.
- Returns:
- the Hash of all the data added to the message digest.
add
public final void add(String message,
int offset,
int length)
- Add the low bytes of a string to the digest (ie. treat the string as ASCII).
- Parameters:
- message - The string to add.
- offset - The start of the data string.
- length - The length of the data string.
add
public final void add(String message)
- Add the low bytes of a string to the digest (ie. treat the string
as ASCII ).
- Parameters:
- message - The string to add.
add
public final void add(byte data[])
- Add a byte array to the digest
- Parameters:
- data - The data to be added.
add
public final void add(byte data[],
int offset,
int length)
- Add a section of a byte array to the digest
- Parameters:
- data - The data to add.
- offset - The start of the data to add.
- length - The length of the data to add.
addToDigest
protected final void addToDigest(byte data[],
int off,
int len)
- Add data to the message digest
This method is protected to ensure that all parameters
are valid at this point - essential if the parameters
are passed to native functions.
- Parameters:
- data - The data to be added.
- off - The start of the data in the array.
- len - The amount of data to add.
hash
public final static byte[] hash(String message,
MessageDigest md)
- A convenience function for hashing a string.
eg:
byte key[] = MessageDigest.hash( passPhrase, new MD5() );
- Parameters:
- message - The string to hash.
- md - An instance of a message digest.
- See Also:
- hash, hash
hash
public final static byte[] hash(byte message[],
MessageDigest md)
- A convenience function for hashing a byte array.
eg:
byte key[] = MessageDigest.hash( bytearray, new MD5() );
- Parameters:
- message - The byte array to hash.
- md - An instance of a message digest.
- See Also:
- hash, hash
All Packages Class Hierarchy This Package Previous Next Index