Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Length is the number of bytes in an ID, though actual representations may be shorter // (with the assumption that left-padded zero bytes can be omitted) Length = 32 )
Variables ¶
Functions ¶
Types ¶
type ID ¶
type ID interface { fmt.Stringer // Bytes returns the byte representation Bytes() []byte // Int returns the big.Int representation Int() *big.Int // Cmp compares the ID to another Cmp(ID) int // Distance computes the XOR distance between two IDs Distance(ID) *big.Int }
ID is an identifier of arbitrary byte length
func FromPublicKey ¶
FromPublicKey returns an ID instance from an elliptic curve public key.
func FromString ¶
FromString creates an ID from a hex-encoded string.
func NewPseudoRandom ¶
NewPseudoRandom returns a pseudo-random ID from a random number generator.
Click to show internal directories.
Click to hide internal directories.