|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.logi.crypto.Crypto
org.logi.crypto.hash.HashState
An subclasses of this object handle the status of a fingerprint still being calculated.
Instances can be continually updated with data and at any point a Fingerprint for the data added so far can be requested.
Fingerprint
Field Summary |
Fields inherited from class org.logi.crypto.Crypto |
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO |
Constructor Summary | |
HashState()
|
Method Summary | |
abstract int |
blockSize()
Return the size of input-blocks for this hash function in bytes. |
abstract Fingerprint |
calculate()
Return a fingerprint for the curret state, without destroying the state. |
static HashState |
create()
Create a HashState object for the default hash function. |
static HashState |
create(java.lang.String algorithm)
Create a HashState object for the named hash function. |
static java.lang.String |
getDefaultHashFunction()
Returns the default hash-function. |
abstract java.lang.String |
getName()
Return the name of the algorithm used by this HashState object. |
abstract int |
hashSize()
Returns the size of a fingerprint in bytes. |
abstract void |
reset()
Reset the state. |
static void |
setDefaultHashFunction(java.lang.String algorithm)
Sets the default hash-function. |
void |
update(byte[] buf)
Update the hash state with the bytes from buf . |
abstract void |
update(byte[] buf,
int offset,
int length)
Update the hash state with the bytes from buf[offset, offset+length-1] . |
void |
update(java.lang.String s)
Update the hash state with the characters from s . |
Methods inherited from class org.logi.crypto.Crypto |
binString, binString, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, hexString, initRandom, initRandom, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, readBlock, readInt, writeBytes, writeBytes, writeInt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HashState()
Method Detail |
public static HashState create(java.lang.String algorithm) throws InvalidCDSException
InvalidCDSException
- if a HashState object for the
named algorithm could not be created.public static HashState create()
public static void setDefaultHashFunction(java.lang.String algorithm) throws InvalidCDSException
Note that changing this will invalidate all values previously returned by the hash() method of objects which generate the hash from a cryptographic fingerprint of themselves. This call should preferably be made before any such hash vlaues are returned, f.ex. in KeyRing objects.
InvalidCDSException
- if a HashState object for the
named algorithm could not be created.public static java.lang.String getDefaultHashFunction()
public abstract java.lang.String getName()
public abstract void reset()
public abstract void update(byte[] buf, int offset, int length)
buf[offset, offset+length-1]
.
public void update(byte[] buf)
buf
.
public void update(java.lang.String s)
s
.
public abstract Fingerprint calculate()
public abstract int blockSize()
public abstract int hashSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |