|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
Represents hashed data, such as a node id, file, IP address etc.
Field Summary | |
---|---|
java.math.BigInteger |
bigInteger
BigInteger version of hash |
int |
BIT_LENGTH
Bit length of hash |
int |
COMPARE_EQUAL
Compare is equal |
int |
COMPARE_GREATER
Compare is greater |
int |
COMPARE_LESS
Compare is less |
byte[] |
hash
Hashed bytes |
string |
keySerial
Serialised version of key |
java.math.BigDecimal |
MappingRatio
Ratio of largest hash to degrees |
System.Security.Cryptography.SHA1 |
sha_
SHA provider |
Naanou.Common.Hash |
ZeroHash
Small hash |
Constructor Summary | |
---|---|
Hash() Initializes a new instance of the Hash class. |
|
Hash(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) Deserialiser |
|
Hash(byte[] hashedBytes) Do not use! |
Method Summary | |
---|---|
Naanou.Common.Hash |
Clone() Clones the hash |
int |
CompareTo(object o) Compares this hash and another hash. Less than zero, and this instance is less than param, zero and instance is equal and greater than zero and instance is greater than param |
bool | Equals(object o) |
Naanou.Common.Hash |
FromBI(java.math.BigInteger bi) Creates a hash from a BigInteger instance |
Naanou.Common.Hash |
FromSerial(string serial) Constructs a Hash from a serial previouslly created via Naanou.Common.Hash.GetSerial |
double |
GetDegrees() Gets the value of this hash mapped to a circle (0-360 degrees) - visualisation helper |
int |
GetHashCode() Gets the hash code for this hash |
Naanou.Common.Hash |
GetHigherFinger(double fingerPowers, int power) Gets the higher finger of this hash |
Naanou.Common.Hash |
GetLowerFinger(double fingerPowers, int power) Gets a lower finger of this hash |
void |
GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) Serialization code |
string |
GetSerial() Returns a string representation of the hash suitable for serialisation |
Naanou.Common.Hash |
Lower(long amount) Gets the lower hash of this |
Naanou.Common.Hash |
Raise(long amount) Gets the higher hash of this |
java.math.BigInteger |
ToBigInteger() Gets a BigInteger form of the Hash |
double |
ToDouble() Gets the hash as a double (warning: precision loss) |
string |
ToNumberString() Gets the hash as a giant number string |
string |
ToString() Gets a human-readable string representation |
Methods inherited from class System.Object |
---|
Finalize, GetType, MemberwiseClone |
Operator Summary | |
---|---|
bool | operator ==(Naanou.Common.Hash x, Naanou.Common.Hash y) |
bool | operator >(Naanou.Common.Hash x, Naanou.Common.Hash y) |
bool | operator >=(Naanou.Common.Hash x, Naanou.Common.Hash y) |
bool | operator !=(Naanou.Common.Hash x, Naanou.Common.Hash y) |
bool | operator <(Naanou.Common.Hash x, Naanou.Common.Hash y) |
bool | operator <=(Naanou.Common.Hash x, Naanou.Common.Hash y) |
Field Detail |
---|
protected java.math.BigInteger bigInteger
BigInteger version of hash
public int BIT_LENGTH
Bit length of hash
public int COMPARE_EQUAL
Compare is equal
public int COMPARE_GREATER
Compare is greater
public int COMPARE_LESS
Compare is less
protected byte[] hash
Hashed bytes
protected string keySerial
Serialised version of key
public java.math.BigDecimal MappingRatio
Ratio of largest hash to degrees
public System.Security.Cryptography.SHA1 sha_
SHA provider
public Naanou.Common.Hash ZeroHash
Small hash
Constructor Detail |
---|
private Hash()
Initializes a new instance of the Hash class.
public Hash(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
Deserialiser
Parameters:
info
- context
- public Hash(byte[] hashedBytes)
Do not use!
Parameters:
hashedBytes
- Hashed bytesMethod Detail |
---|
public Naanou.Common.Hash Clone()
Clones the hash
Returns:
public int CompareTo(object o)
Compares this hash and another hash. Less than zero, and this instance is less than param, zero and instance is equal and greater than zero and instance is greater than param
Parameters:
o
- Object to compare withpublic bool Equals(object o)
public Naanou.Common.Hash FromBI(java.math.BigInteger bi)
Creates a hash from a BigInteger instance
Parameters:
bi
- BigIntegerpublic Naanou.Common.Hash FromSerial(string serial)
Constructs a Hash from a serial previouslly created via Naanou.Common.Hash.GetSerial
Parameters:
serial
- Serialpublic double GetDegrees()
Gets the value of this hash mapped to a circle (0-360 degrees) - visualisation helper
Returns:
public int GetHashCode()
Gets the hash code for this hash
Returns:
public Naanou.Common.Hash GetHigherFinger(double fingerPowers, int power)
Gets the higher finger of this hash
Parameters:
fingerPowers
- Powerspower
- Powerpublic Naanou.Common.Hash GetLowerFinger(double fingerPowers, int power)
Gets a lower finger of this hash
Parameters:
fingerPowers
- Powerspower
- Powerpublic void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
Serialization code
Parameters:
info
- context
- public string GetSerial()
Returns a string representation of the hash suitable for serialisation
Returns:
public Naanou.Common.Hash Lower(long amount)
Gets the lower hash of this
Parameters:
amount
- Amountpublic Naanou.Common.Hash Raise(long amount)
Gets the higher hash of this
Parameters:
amount
- Amountpublic java.math.BigInteger ToBigInteger()
Gets a BigInteger form of the Hash
Returns:
public double ToDouble()
Gets the hash as a double (warning: precision loss)
Returns:
public string ToNumberString()
Gets the hash as a giant number string
Returns:
public string ToString()
Gets a human-readable string representation
Returns:
Operator Detail |
---|
public bool operator ==(Naanou.Common.Hash x, Naanou.Common.Hash y)
public bool operator >(Naanou.Common.Hash x, Naanou.Common.Hash y)
public bool operator >=(Naanou.Common.Hash x, Naanou.Common.Hash y)
public bool operator !=(Naanou.Common.Hash x, Naanou.Common.Hash y)
public bool operator <(Naanou.Common.Hash x, Naanou.Common.Hash y)
public bool operator <=(Naanou.Common.Hash x, Naanou.Common.Hash y)
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |