Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonPrefixLength ¶
CommonPrefixLenght compares to InfoHashes bitwise and finds the length of the bit-prefix both have in common.
Types ¶
type InfoHash ¶
type InfoHash [32]byte
InfoHash is the representation of an identifier in the MonkeyNet. As such, it is initialized once and does not change afterwards.
An InfoHash is a 256bit data structure that is obtained by reading from a byte slice or by generating a new random InfoHash. It is intended to be generated by applying a hash function to a key in the distributed hash table.
func NewRandom ¶
NewRandom generates an InfoHash through crypto/rand. If an error occurs during reading from the crypto/rand device, an empty InfoHash is returned with the error that reading from the crypto/rand device produced.
func (*InfoHash) Empty ¶
Empty checks if an InfoHash was already initialised. If there are only bx00000000 bytes in the InfoHash, it is assumed uninitialised. An empty value therefore is an illegal identifier
func (InfoHash) String ¶
Implementation of the Stringer interface. All hashes are written as their base64-encoded content