# Package net.i2p.kademlia

Generic Kademlia distributed hash table implementation supporting multiple hash algorithms (SHA1, SHA256, etc.).

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  KBucket<T extends SimpleDataStructure> | Group, without inherent ordering, a set of keys a certain distance away from a local key, using XOR as the distance metric Refactored from net.i2p.router.networkdb.kademlia
  KBucketTrimmer<K extends SimpleDataStructure> | Called when a kbucket can no longer be split and is too big
  SelectionCollector<T extends SimpleDataStructure> | Visit kbuckets, gathering matches

- Class Summary
  Class | Description
  --- | ---
  KBucketImpl<T extends SimpleDataStructure> | A concurrent implementation using ConcurrentHashSet.
  KBucketSet<T extends SimpleDataStructure> | In-memory storage of buckets sorted by XOR metric from base (us) passed in via constructor.
  RandomIfOldTrimmer<T extends SimpleDataStructure> | Removes a random element, but only if the bucket hasn't changed in 5 minutes.
  RandomTrimmer<T extends SimpleDataStructure> | Removes a random element.
  RejectTrimmer<T extends SimpleDataStructure> | Removes nothing and always rejects the add.
  XORComparator<T extends SimpleDataStructure> | Help sort Hashes in relation to a base key using the XOR metric

## Package net.i2p.kademlia Description

Generic Kademlia distributed hash table implementation supporting multiple hash algorithms (SHA1, SHA256, etc.).

This package provides:

- KBucket implementation for peer storage
- KBucketSet for managing multiple buckets
- Generic key support for different hash lengths
- Kademlia routing table management

Major rewrite of KBucket, KBucketSet, and KBucketImpl from net.i2p.router.networkdb.kademlia. The classes are now generic to support SHA1, SHA256, or other key lengths. Packaged in i2psnark since 0.9.2, and moved to core in 0.9.10 so that network database can use it.