{"action":"created","issue":{"url":"https://api.github.com/repos/tristanls/k-bucket/issues/29","repository_url":"https://api.github.com/repos/tristanls/k-bucket","labels_url":"https://api.github.com/repos/tristanls/k-bucket/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/tristanls/k-bucket/issues/29/comments","events_url":"https://api.github.com/repos/tristanls/k-bucket/issues/29/events","html_url":"https://github.com/tristanls/k-bucket/issues/29","id":154919956,"number":29,"title":"KBucket.distance","user":{"login":"fanatid","id":2633065,"avatar_url":"https://avatars.githubusercontent.com/u/2633065?v=3","gravatar_id":"","url":"https://api.github.com/users/fanatid","html_url":"https://github.com/fanatid","followers_url":"https://api.github.com/users/fanatid/followers","following_url":"https://api.github.com/users/fanatid/following{/other_user}","gists_url":"https://api.github.com/users/fanatid/gists{/gist_id}","starred_url":"https://api.github.com/users/fanatid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanatid/subscriptions","organizations_url":"https://api.github.com/users/fanatid/orgs","repos_url":"https://api.github.com/users/fanatid/repos","events_url":"https://api.github.com/users/fanatid/events{/privacy}","received_events_url":"https://api.github.com/users/fanatid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-15T17:33:40Z","updated_at":"2016-05-16T15:45:18Z","closed_at":null,"body":"Should not be here [index.js#L98](https://github.com/tristanls/k-bucket/blob/9e31387a454bde57c5954694b37eb0c11bfcae26/index.js#L98) value from largest buffer, not 255?"},"comment":{"url":"https://api.github.com/repos/tristanls/k-bucket/issues/comments/219460559","html_url":"https://github.com/tristanls/k-bucket/issues/29#issuecomment-219460559","issue_url":"https://api.github.com/repos/tristanls/k-bucket/issues/29","id":219460559,"user":{"login":"fanatid","id":2633065,"avatar_url":"https://avatars.githubusercontent.com/u/2633065?v=3","gravatar_id":"","url":"https://api.github.com/users/fanatid","html_url":"https://github.com/fanatid","followers_url":"https://api.github.com/users/fanatid/followers","following_url":"https://api.github.com/users/fanatid/following{/other_user}","gists_url":"https://api.github.com/users/fanatid/gists{/gist_id}","starred_url":"https://api.github.com/users/fanatid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fanatid/subscriptions","organizations_url":"https://api.github.com/users/fanatid/orgs","repos_url":"https://api.github.com/users/fanatid/repos","events_url":"https://api.github.com/users/fanatid/events{/privacy}","received_events_url":"https://api.github.com/users/fanatid/received_events","type":"User","site_admin":false},"created_at":"2016-05-16T15:45:18Z","updated_at":"2016-05-16T15:45:18Z","body":"Sorry, can't understand your truth table, how bit can not exists in a middle?\r\n\r\nI understand that usually length of ids is equal, so this question almost doesn't make sense, but I still think that we should take value from longest id, not 255. For example, if we have 3 ids:\r\na = '.com'\r\nb = '.com.em'\r\nc = '.com.me'\r\n\r\nxor(a, b) should not be equal to xor(a, c), right? but with current implementation we receive that distance is equal..\r\n\r\nyour example with modified distance:\r\n```js\r\nvar xor = require('buffer-xor')\r\n\r\nfunction distance (firstId, secondId) {\r\n  var buffer = xor(firstId, secondId)\r\n  return buffer.reduce(function (d, v) { return d * 256 + v }, 0)\r\n}\r\n\r\ndistance(new Buffer(\".com.mystuff\"), new Buffer(\".com.mystuff.detailed\"))\r\n// => 855784543728809300000\r\ndistance(new Buffer(\".com\"), new Buffer(\".com.mystuff.detailed\"))\r\n// => 1.5798505339527512e+40\r\n```"}}