I'm trying to implement this protocol: http://en.wikipedia.org/wiki/Chord_(peer-to-peer)
What i understood from it is that each node that joins the "circle" is placed in a random place inside the circle, depending on it's hashed IP+port value. But my question is ... how can i obtain an integer value (index) for each node? How to i assign the unique hash value of the ip+port to a unique index number...Some functions check to see if for example an id is inside an interval (e.g. id>n & id<=successor), so it seems i need a unique int for each node, i can't just use the hash value. Any suggestions?
You can download the Chord implementation from the creators (It's free)
http://pdos.csail.mit.edu/chord/#downloads
(Sorry thought you just wanted a working DHT!)
[edit] I believe the hash based approach is the best way if you want to avoid naming collisions. However, if you need to use INT's you could introduce a slight overhead by having your DHT manage naming collisions and dealing with it in some form. Then to ensure you have an int representation you could just multiple the final two addresses spaces of the IP address. e.g ip = 192.168.2.14 the ID would be 28.
This obviously makes your system less robust. Any reason you can't use hashes?
[/edit]