DHT Security

The expression to calculate a valid ID prefix (from an IPv4 address) is:

sha1((ip & 0x01071f7f) .. r)

And for an IPv6 address (ip is the high 64 bits of the address):

sha1((ip & 0x000103070f1f3f7f) ..  r)