1 | const bench = require('./')
|
2 |
|
3 | bench('sha1 200.000 times', function (b) {
|
4 | const crypto = require('crypto')
|
5 | let data = Buffer.from('hello world')
|
6 |
|
7 | b.start()
|
8 |
|
9 | for (let i = 0; i < 200000; i++) {
|
10 | data = crypto.createHash('sha1').update(data).digest()
|
11 | }
|
12 |
|
13 | b.end()
|
14 | })
|
15 |
|
16 | bench('sha256 200.000 times', function (b) {
|
17 | const crypto = require('crypto')
|
18 | let data = Buffer.from('hello world')
|
19 |
|
20 | b.start()
|
21 |
|
22 | for (let i = 0; i < 200000; i++) {
|
23 | data = crypto.createHash('sha256').update(data).digest()
|
24 | }
|
25 |
|
26 | b.end()
|
27 | })
|