forked from VerusCoin/verushash-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
37 lines (27 loc) · 1.56 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// var cluster = require('cluster');
var vh = require('bindings')('verushash.node');
var reverseHex = function (hex) {
return Buffer.from(hex, 'hex').reverse().toString('hex');
};
// var numWorkers = require('os').cpus().length;
// numWorkers = 1; /* increase for multi-thread testing of data collision */
// if (cluster.isMaster) {
// var workers = [];
// var gbtCount = 0;
// for (var i = 0; i < numWorkers; i++){
// var worker = cluster.fork({
// workerType: 'VerusHasher',
// forkId: i
// });
// workers.push(worker);
// }
// } else {
var output = vh.hash(Buffer.from('Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234','utf8'));
console.log(process.pid,'VerusHash1 Output', reverseHex(output.toString('hex')), '\n');
output = vh.hash2(Buffer.from('Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234','utf8'));
console.log(process.pid,'VerusHash2 Output', reverseHex(output.toString('hex')), '\n');
output = vh.hash2b(Buffer.from('Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234','utf8'));
console.log(process.pid,'VerusHash2b Output', reverseHex(output.toString('hex')), '\n');
output = vh.hash2b1(Buffer.from('Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234Test1234','utf8'));
console.log(process.pid,'VerusHash2b1 Output', reverseHex(output.toString('hex')), '\n');
// }