Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultSize = 4096 MaxPO = 16 AddressLength = 32 )
Variables ¶
View Source
var ( ErrChunkNotFound = errors.New("chunk not found") ErrChunkInvalid = errors.New("invalid chunk") )
View Source
var ZeroAddr = Address(common.Hash{}.Bytes())
Functions ¶
func Proximity ¶
Proximity returns the proximity order of the MSB distance between x and y
The distance metric MSB(x, y) of two equal length byte sequences x an y is the value of the binary integer cast of the x^y, ie., x and y bitwise xor-ed. the binary cast is big endian: most significant bit first (=MSB).
Proximity(x, y) is a discrete logarithmic scaling of the MSB distance. It is defined as the reverse rank of the integer part of the base 2 logarithm of the distance. It is calculated by counting the number of common leading zeros in the (MSB) binary representation of the x^y.
(0 farthest, 255 closest, 256 self)
Types ¶
Click to show internal directories.
Click to hide internal directories.