forked from simonepri/phc-argon2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbench.js
71 lines (66 loc) · 1.94 KB
/
bench.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';
const execa = require('execa');
const pbkdf2 = require('.');
async function bench(hpass, vpass, options) {
const hash = await pbkdf2.hash(hpass, options);
return execa(
'sympact',
['--interval=25', `await require(".").verify("${hash}","${vpass}")`],
{
env: {FORCE_COLOR: true},
windowsVerbatimArguments: true
}
);
}
Promise.resolve()
// Default configs
.then(() => bench('r9(yaV@L', 'r9(yaV@L'))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
// Custom Iterations
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {iterations: 5}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {iterations: 10}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {iterations: 25}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {iterations: 50}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {iterations: 100}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
// Custom Memory
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {memory: 2 ** 14}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {memory: 2 ** 16}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.then(() => bench('r9(yaV@L', 'r9(yaV@L', {memory: 2 ** 18}))
.then((results) => {
console.log('► CMD:', results.cmd);
console.log(results.stdout);
})
.catch((error) => {
console.error(error);
});