C# 클래스 Kademlia.ID

상속: IComparable
파일 보기 프로젝트 열기: zencoders/sambatyon 1 사용 예제들

공개 메소드들

메소드 설명
CompareTo ( object obj ) : int

Compare ourselves to an object

DifferingBit ( ID other ) : int

Determines the least significant bit at which the given ID differs from this one, from 0 through 8 * ID_LENGTH - 1. PRECONDITION: IDs do not match.

Equals ( object obj ) : bool

Method used to verify if two objects are equals.

FromString ( string hash ) : ID

Method that generates an ID starting from a generic string. This is not hashing.

GetHashCode ( ) : int

Method used to get the hash code according to the algorithm: http://stackoverflow.com/questions/16340/how-do-i-generate-a-hashcode-from-a-byte-array-in-c/425184#425184

Hash ( string key ) : ID

Hash a string to produce an ID

HostID ( ) : ID

Get an ID that will be the same between different calls on the same machine by the same app run by the same user. If that ID is taken, returns a random ID.

ID ( byte data ) : System

Make a new ID from a byte array.

ID ( string new_id ) : System

Make a new ID starting from a string. Pay attention, the string is not hashed, it is simply translated to an ID object.

RandomID ( ) : ID

Produce a random ID.

RandomizeBeyond ( int bit ) : ID

Return a copy of ourselves that differs from us at the given bit and is random beyond that.

ToPathString ( ) : string

Returns this ID represented as a path-safe string.

ToString ( ) : string

Turn this ID into a string.

operator ( ) : ID

XOR operator. This is our distance metric in the DHT.

operator ( ) : bool

We need to compare these when measuring distance

비공개 메소드들

메소드 설명
FlipBit ( byte data, int bit ) : void

Flips the given bit in the byte array. Byte array must be ID_LENGTH long.

IDInit ( byte data ) : void

This method initialize an id starting from a byte array.

메소드 상세

CompareTo() 공개 메소드

Compare ourselves to an object
public CompareTo ( object obj ) : int
obj object An obect to compare to
리턴 int

DifferingBit() 공개 메소드

Determines the least significant bit at which the given ID differs from this one, from 0 through 8 * ID_LENGTH - 1. PRECONDITION: IDs do not match.
public DifferingBit ( ID other ) : int
other ID The ID to compare to
리턴 int

Equals() 공개 메소드

Method used to verify if two objects are equals.
public Equals ( object obj ) : bool
obj object The object to compare to
리턴 bool

FromString() 공개 정적인 메소드

Method that generates an ID starting from a generic string. This is not hashing.
public static FromString ( string hash ) : ID
hash string The hash string originating an ID
리턴 ID

GetHashCode() 공개 메소드

Method used to get the hash code according to the algorithm: http://stackoverflow.com/questions/16340/how-do-i-generate-a-hashcode-from-a-byte-array-in-c/425184#425184
public GetHashCode ( ) : int
리턴 int

Hash() 공개 정적인 메소드

Hash a string to produce an ID
public static Hash ( string key ) : ID
key string Key string to convert
리턴 ID

HostID() 공개 정적인 메소드

Get an ID that will be the same between different calls on the same machine by the same app run by the same user. If that ID is taken, returns a random ID.
public static HostID ( ) : ID
리턴 ID

ID() 공개 메소드

Make a new ID from a byte array.
public ID ( byte data ) : System
data byte An array of exactly 20 bytes.
리턴 System

ID() 공개 메소드

Make a new ID starting from a string. Pay attention, the string is not hashed, it is simply translated to an ID object.
public ID ( string new_id ) : System
new_id string The string to translate
리턴 System

RandomID() 공개 정적인 메소드

Produce a random ID.
public static RandomID ( ) : ID
리턴 ID

RandomizeBeyond() 공개 메소드

Return a copy of ourselves that differs from us at the given bit and is random beyond that.
public RandomizeBeyond ( int bit ) : ID
bit int the bit to start to launch random bits
리턴 ID

ToPathString() 공개 메소드

Returns this ID represented as a path-safe string.
public ToPathString ( ) : string
리턴 string

ToString() 공개 메소드

Turn this ID into a string.
public ToString ( ) : string
리턴 string

operator() 공개 정적인 메소드

XOR operator. This is our distance metric in the DHT.
public static operator ( ) : ID
리턴 ID

operator() 공개 정적인 메소드

We need to compare these when measuring distance
public static operator ( ) : bool
리턴 bool