|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.logi.crypto.Crypto | +--org.logi.crypto.hash.Fingerprint
This class is used to hold a fingerprint of a particular data buffer. The idea is to calculate a fingerprint in such a way that it is difficult to create a buffer that gives a particular fingerprint. If that buffer also has to match some other criteria, such as being a valid text file in a particular language, then it becomes next to impossible.
All this depends on the hash function used to create the fingerprint being a good one. Fingerprints are created by the various subclasses of HashState, so you should look there for information about a particular hash function.
The CDS for a Fingerprint object is Fingerprint(name,fp)
where name
is the name of the algorithm used and
fp
the actual fingerprint.
HashState
,
Signature
Fields inherited from class org.logi.crypto.Crypto |
BIT,
cdsPath,
EMPTY_ARRAY,
FOUR,
keySource,
NIBBLE,
ONE,
primeCertainty,
random,
TWO,
ZERO |
Constructor Summary | |
Fingerprint(java.lang.String algorithm,
byte[] fp,
int offset,
int n)
Creates a new Fingerprint object. |
Method Summary | |
static Fingerprint |
create(byte[] buf,
int offset,
int length,
java.lang.String algorithm)
Create a Fingerprint object. |
static Fingerprint |
create(byte[] buf,
java.lang.String algorithm)
Create a Fingerprint object. |
static Fingerprint |
create(java.lang.String s,
java.lang.String algorithm)
Create a Fingerprint object. |
boolean |
equals(java.lang.Object obj)
Test for equality with another object. |
byte[] |
getBytes()
Return an array of the bytes in the fingerprint. |
java.lang.String |
getName()
Return the name of the algorithm used for this fingerprint. |
int |
hashCode()
Return a hash-code based on the bytes of the fingerprint and the algorithm name. |
static Fingerprint |
parseCDS(java.lang.String arg)
If "Fingerprint( key )" is a valid CDS for a Fingerprint, then Fingerprint.parseCDS(key) will return the described Fingerprint object. |
java.lang.String |
toString()
Return a CDS for this fingerprint. |
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,
readInt,
writeBytes,
writeBytes,
writeInt |
Methods inherited from class java.lang.Object |
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Fingerprint(java.lang.String algorithm, byte[] fp, int offset, int n)
fp[offset..offset+n-1]
which was generated with the
named algorithm.Method Detail |
public static Fingerprint create(byte[] buf, int offset, int length, java.lang.String algorithm) throws InvalidCDSException
buf[offset..offset+length-1]
calculated with
the named fingerprint algorithm.public static Fingerprint create(byte[] buf, java.lang.String algorithm) throws InvalidCDSException
buf
calculated with the named
fingerprint algorithm.public static Fingerprint create(java.lang.String s, java.lang.String algorithm) throws InvalidCDSException
public static Fingerprint parseCDS(java.lang.String arg) throws InvalidCDSException
A valid CDS can be created by calling the Fingerprint.toString() method.
Crypto.fromString(String)
public java.lang.String getName()
public byte[] getBytes()
public boolean equals(java.lang.Object obj)
obj
is a Fingerprint equal to this
.public int hashCode()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |