Package net.i2p.data
Class Signature
java.lang.Object
net.i2p.data.SimpleDataStructure
net.i2p.data.Signature
- All Implemented Interfaces:
DataStructure
public class Signature extends SimpleDataStructure
Defines the signature as defined by the I2P data structure spec.
By default, a signature is a 40-byte array verifying the authenticity of some data
using the DSA-SHA1 algorithm.
The signature is the 20-byte R followed by the 20-byte S,
both are unsigned integers.
As of release 0.9.8, signatures of arbitrary length and type are supported.
See SigType.
- Author:
- jrandom
-
Field Summary
Fields Modifier and Type Field Description static byte[]FAKE_SIGNATUREDeprecated.to be removedstatic intSIGNATURE_BYTES40 -
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleanequals(Object obj)Warning - this returns true for two different classes with the same size and same data, e.g.SigTypegetType()inthashCode()We assume the data has enough randomness in it, so use the first 4 bytes for speed.intlength()The legal length of the byte array in this data structureStringtoString()Methods inherited from class net.i2p.data.SimpleDataStructure
calculateHash, fromBase64, fromByteArray, getData, read, readBytes, setData, toBase64, toByteArray, writeBytes
-
Field Details
-
SIGNATURE_BYTES
public static final int SIGNATURE_BYTES40 -
FAKE_SIGNATURE
Deprecated.to be removedall zeros
-
-
Constructor Details
-
Method Details
-
length
public int length()Description copied from class:SimpleDataStructureThe legal length of the byte array in this data structure- Specified by:
lengthin classSimpleDataStructure
-
getType
- Returns:
- non-null
- Since:
- 0.9.8
-
toString
- Overrides:
toStringin classSimpleDataStructure- Since:
- 0.9.8
-
hashCode
public int hashCode()Description copied from class:SimpleDataStructureWe assume the data has enough randomness in it, so use the first 4 bytes for speed. If this is not the case, override in the extending class.- Overrides:
hashCodein classSimpleDataStructure- Since:
- 0.9.17
-
equals
Description copied from class:SimpleDataStructureWarning - this returns true for two different classes with the same size and same data, e.g. SessionKey and SessionTag, but you wouldn't put them in the same Set, would you?- Overrides:
equalsin classSimpleDataStructure- Since:
- 0.9.17
-