You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
332 B
21 lines
332 B
var xor = require('xor-distance')
|
|
|
|
var arr = []
|
|
|
|
var a = require('crypto').randomBytes(32)
|
|
|
|
for (var i = 0; i < 100; i++) {
|
|
var node = require('crypto').randomBytes(32)
|
|
arr.push({
|
|
dist: xor(node, a),
|
|
node: node
|
|
})
|
|
}
|
|
|
|
|
|
arr.sort(function (a, b) {
|
|
return xor.compare(a.dist, b.dist)
|
|
})
|
|
|
|
console.log(a)
|
|
console.log(arr)
|
|
|