Skip to content

Instantly share code, notes, and snippets.

@0xa
Created July 15, 2013 02:14
Show Gist options
  • Save 0xa/5997069 to your computer and use it in GitHub Desktop.
Save 0xa/5997069 to your computer and use it in GitHub Desktop.
namespace Kademlia {
template<int _Size, class _Parent>
struct ID {
char data[_Size];
inline _Parent operator^(ID y) {
_Parent result;
int i;
for (i=0; i<_Size; i++) {
result.data[i] = data[i] ^ y.data[i];
}
return result;
}
};
struct Key : public ID<160/8, Key> {};
struct NodeID : public ID<160/8, NodeID> {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment