I'm developing a P2P phone network where each node is assigned a 16-digit decimal 'phone number', which gives me a total of 10,000,000,000,000,000 possible identifiers. I'm concerned about the likelihood of collisions, as doubling the nodes halves the chance of a collision occurring. Is this range of phone numbers adequate to minimize collisions? Just as background, these identifiers are hashes of the node's public key in decimal form, aiming to balance collision rates and user-friendliness for dialing on traditional phones. Each node acts as both a server and a client, and to connect, a node registers with the three closest servers based on a hashed version of its own number, helping to keep actual phone numbers private.
6 Answers
If you hit about a million users, the probability of a collision is very low—about 0.005%. But keep in mind that as you reach 45 million users, that jumps to around 10%. It's all about how comfortable you are with that risk!
Have you considered using alphanumeric characters? It would expand your pool significantly and could be more user-friendly. Plus, it could let users pick their identifiers; however, I get it if you're stuck on decimal—it’s about backward compatibility for traditional dialing.
When avoiding collisions, think about optimal table sizes; look at prime numbers near powers of 2. Instead of preparing space for every hash entry, consider pointing hash buckets to data structures like red-black trees. They can help manage potential collisions better while balancing performance.
How many nodes are you expecting in your network? That’s a key factor in your collision calculations!
I'm not entirely sure. I’m open-sourcing it, so anyone can use it, from individuals to businesses, possibly leading to many users. I just want to make sure I accommodate as many as possible.
You might explore using MAC addresses to ensure uniqueness. Every device has a MAC address that's definitely unique. You could encode that to derive phone numbers while keeping things simple for the user. It’d be a tidy way to manage identifiers without allowing number abuse.
That's a good idea, but it does bypass proving ownership of a number. I want to ensure users can’t just claim any number they fancy.
Keep in mind, the world population is projected to be around 10-15 billion by 2100. You might want to study existing telephone numbering plans like E.164 which caps at 15 digits, making this an interesting challenge for user growth in the future.

That’s a valid point about compatibility. I want this to work with older phones and setups, making it easier for users looking for a straightforward installation—like a Raspberry Pi giving them an easy way to call securely.