|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgnu.crypto.hash.BaseHashStandalone
public abstract class BaseHashStandalone
A base abstract class to facilitate hash implementations.
WARNING - DEPRECATED - Use SHA256Generator.getDigestInstance() to get a MessageDigest that will be faster in almost all cases. See SHA256Generator for more information.
| Field Summary | |
|---|---|
protected int |
blockSize
The hash (inner) block size in bytes. |
protected byte[] |
buffer
Temporary input buffer. |
protected long |
count
Number of bytes processed so far. |
protected int |
hashSize
The hash (output) size in bytes. |
protected String |
name
The canonical name prefix of the hash. |
| Constructor Summary | |
|---|---|
protected |
BaseHashStandalone(String name,
int hashSize,
int blockSize)
Trivial constructor for use by concrete subclasses. |
| Method Summary | |
|---|---|
int |
blockSize()
Returns the algorithm's (inner) block size in bytes. |
abstract Object |
clone()
Returns a clone copy of this instance. |
byte[] |
digest()
Completes the message digest by performing final operations such as padding and resetting the instance. |
protected abstract byte[] |
getResult()
Constructs the result from the contents of the current context. |
int |
hashSize()
Returns the output length in bytes of this message digest algorithm. |
String |
name()
Returns the canonical name of this algorithm. |
protected abstract byte[] |
padBuffer()
Returns the byte array to use as padding before completing a hash operation. |
void |
reset()
Resets the current context of this instance clearing any eventually cached intermediary values. |
protected abstract void |
resetContext()
Resets the instance for future re-use. |
abstract boolean |
selfTest()
A basic test. |
protected abstract void |
transform(byte[] in,
int offset)
The block digest transformation per se. |
void |
update(byte b)
Continues a message digest operation using the input byte. |
void |
update(byte[] b)
Continues a message digest operation, by filling the buffer, processing data in the algorithm's HASH_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation. |
void |
update(byte[] b,
int offset,
int len)
Continues a message digest operation, by filling the buffer, processing data in the algorithm's HASH_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String name
protected int hashSize
protected int blockSize
protected long count
protected byte[] buffer
| Constructor Detail |
|---|
protected BaseHashStandalone(String name,
int hashSize,
int blockSize)
Trivial constructor for use by concrete subclasses.
name - the canonical name prefix of this instance.hashSize - the block size of the output in bytes.blockSize - the block size of the internal transform.| Method Detail |
|---|
public String name()
IMessageDigestStandaloneReturns the canonical name of this algorithm.
name in interface IMessageDigestStandalonepublic int hashSize()
IMessageDigestStandaloneReturns the output length in bytes of this message digest algorithm.
hashSize in interface IMessageDigestStandalonepublic int blockSize()
IMessageDigestStandaloneReturns the algorithm's (inner) block size in bytes.
blockSize in interface IMessageDigestStandalonepublic void update(byte b)
IMessageDigestStandaloneContinues a message digest operation using the input byte.
update in interface IMessageDigestStandaloneb - the input byte to digest.public void update(byte[] b)
IMessageDigestStandaloneContinues a message digest operation, by filling the buffer, processing data in the algorithm's HASH_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation.
update in interface IMessageDigestStandaloneb - the input block.
public void update(byte[] b,
int offset,
int len)
IMessageDigestStandaloneContinues a message digest operation, by filling the buffer, processing data in the algorithm's HASH_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation.
update in interface IMessageDigestStandaloneb - the input block.offset - start of meaningful bytes in input block.len - number of bytes, in input block, to consider.public byte[] digest()
IMessageDigestStandaloneCompletes the message digest by performing final operations such as padding and resetting the instance.
digest in interface IMessageDigestStandalonepublic void reset()
IMessageDigestStandaloneResets the current context of this instance clearing any eventually cached intermediary values.
reset in interface IMessageDigestStandalonepublic abstract Object clone()
IMessageDigestStandaloneReturns a clone copy of this instance.
clone in interface IMessageDigestStandaloneclone in class Objectpublic abstract boolean selfTest()
IMessageDigestStandaloneA basic test. Ensures that the digest of a pre-determined message is equal to a known pre-computed value.
selfTest in interface IMessageDigestStandaloneprotected abstract byte[] padBuffer()
Returns the byte array to use as padding before completing a hash operation.
protected abstract byte[] getResult()
Constructs the result from the contents of the current context.
protected abstract void resetContext()
protected abstract void transform(byte[] in,
int offset)
The block digest transformation per se.
in - the blockSize long block, as an array of bytes to digest.offset - the index where the data to digest is located within the
input buffer.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||