ostore.util
Class SecureHashBuffer
java.lang.Object
|
+--ostore.util.SecureHashBuffer
- Direct Known Subclasses:
- SHA1HashBuffer
- public abstract class SecureHashBuffer
- extends Object
A MessageDigest
-like interface for building
SecureHash
es.
Users should call add
for each object to include in the
SecureHash
and then call toHash
once.
Invocations of toHash
reset the
SecureHashBuffer
, so do not attempt to produce
intermediate hashes with a single buffer.
- Version:
- $Id: SecureHashBuffer.java,v 1.4 2002/03/29 21:14:53 eaton Exp $
- Author:
- Dennis Geels
- See Also:
Digestible
,
MessageDigest
Method Summary |
void |
add(BigInteger value)
|
void |
add(boolean b)
|
abstract void |
add(byte input)
Adds the specified byte to the digest. |
abstract void |
add(byte[] input)
Adds the specified byte array to the digest. |
abstract void |
add(byte[] input,
int offset,
int length)
Adds length bytes of the specified array to the digest,
starting at offset . |
abstract void |
add(Digestible input)
Adds the specified object to the digest. |
void |
add(int i)
|
void |
add(long i)
|
void |
add(String s)
|
abstract SecureHash |
toHash()
Computes and returns the digest of all inputs. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SecureHashBuffer
public SecureHashBuffer()
add
public abstract void add(byte input)
- Adds the specified byte to the digest.
add
public abstract void add(byte[] input)
- Adds the specified byte array to the digest.
add
public abstract void add(byte[] input,
int offset,
int length)
- Adds
length
bytes of the specified array to the digest,
starting at offset
.
add
public abstract void add(Digestible input)
- Adds the specified object to the digest.
This method invokes the
input.add_to_digest
method; be careful to avoid infinite loops.
add
public final void add(boolean b)
add
public final void add(int i)
add
public final void add(long i)
add
public final void add(String s)
add
public final void add(BigInteger value)
toHash
public abstract SecureHash toHash()
- Computes and returns the digest of all inputs. Also resets internal
state, so do not attempt to produce intermediate hashes by
calling this method prematurely.