2016-11-17 04:53:10 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
2017-10-25 20:07:22 -07:00
|
|
|
const random = require('bcrypto/lib/random');
|
2017-06-29 20:54:07 -07:00
|
|
|
const Script = require('../lib/script/script');
|
|
|
|
|
const bench = require('./bench');
|
2016-11-17 04:53:10 -08:00
|
|
|
|
2017-07-27 14:51:55 -07:00
|
|
|
const hashes = [];
|
2016-11-17 04:53:10 -08:00
|
|
|
|
2017-07-27 14:51:55 -07:00
|
|
|
for (let i = 0; i < 100000; i++)
|
2017-06-27 06:34:22 -07:00
|
|
|
hashes.push(random.randomBytes(20));
|
2016-11-17 04:53:10 -08:00
|
|
|
|
2017-07-27 14:51:55 -07:00
|
|
|
{
|
|
|
|
|
const end = bench('hash');
|
|
|
|
|
for (let i = 0; i < hashes.length; i++)
|
|
|
|
|
Script.fromPubkeyhash(hashes[i]);
|
|
|
|
|
end(100000);
|
|
|
|
|
}
|