init
This commit is contained in:
commit
44f31f8b9f
402 changed files with 47865 additions and 0 deletions
26
services/pedersen.js
Normal file
26
services/pedersen.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { buildPedersenHash } from 'circomlibjs'
|
||||
|
||||
class Pedersen {
|
||||
constructor() {
|
||||
this.pedersenHash = null
|
||||
this.babyJub = null
|
||||
this.initPedersen()
|
||||
}
|
||||
|
||||
async initPedersen() {
|
||||
this.pedersenHash = await buildPedersenHash()
|
||||
this.babyJub = this.pedersenHash.babyJub
|
||||
}
|
||||
|
||||
unpackPoint(buffer) {
|
||||
return this.babyJub.unpackPoint(this.pedersenHash.hash(buffer))
|
||||
}
|
||||
|
||||
toStringBuffer(buffer) {
|
||||
return this.babyJub.F.toString(buffer)
|
||||
}
|
||||
}
|
||||
|
||||
const pedersen = new Pedersen()
|
||||
|
||||
export { pedersen }
|
Loading…
Add table
Add a link
Reference in a new issue