问题
The Kademlia paper states that nodes are assigned random 160-bit IDs as well as the keys. Is this a strict restriction? Can I still go ahead and use a 128-bit keyspace if that's good enough from me?
回答1:
The length was chosen because SHA1, used as hash function for the hash table keys, outputs 160bits and that was the most widely used hash function at the time.
The routing algorithm itself does not require that specific length to work, all it needs is the key space being large enough to avoid collisions in randomly chosen IDs. 128bit IDs would provide 64bits of collision space, which should be sufficient unless you intend to address grey goo.
But in addition to the routing algorithm itself cryptographic concerns may also be relevant. Networks that use encryption benefit from node IDs doubling as the node's public key and commonly deployed ECC algorithms require public keys of at least 256 bits. Additionally resistance against (currently hypothetical) quantum attacks has inflated recommended hash function sizes well beyond 128 bits since they would cut collision resistance to N/3 down from N/2 for classical attacks.
来源:https://stackoverflow.com/questions/56431524/in-kademlia-why-is-it-recommended-to-have-160-bit-node-ids-and-keys-and-not-128