circomlibjs/src/pedersen_printbases.js

36 lines
769 B
JavaScript
Raw Normal View History

2021-10-30 13:57:29 +02:00
import buildPedersenHash from "./pedersenhash.js";
2021-10-06 11:28:14 +02:00
2021-10-30 13:57:29 +02:00
async function run() {
const pedersenHash = await buildPedersenHash();
2021-10-06 11:28:14 +02:00
2021-10-30 13:57:29 +02:00
let nBases;
if (typeof process.argv[2] != "undefined") {
nBases = parseInt(process.argv[2]);
} else {
nBases = 5;
}
let baseHash;
if (typeof process.argv[3] != "undefined") {
baseHash = process.argv[3];
} else {
baseHash = "blake";
}
for (let i=0; i < nBases; i++) {
const p = pedersenHash.getBasePoint(i);
console.log(`[${pedersenHash.babyJub.F.toString(p[0])},${pedersenHash.babyJub.F.toString(p[1])}]`);
}
2021-10-06 11:28:14 +02:00
}
2021-10-30 13:57:29 +02:00
run().then(()=> {
process.exit(0);
}, (err) => {
console.log(err.stack);
console.log(err.message);
process.exit(1);
});