Crypto Module
Table of contents
Classes
Interfaces
Type Aliases
Variables
Functions
- bigInt2Buffer
- calcDepthFromNumLeaves
- deepCopyBigIntArray
- formatPrivKeyForBabyJub
- genEcdhSharedKey
- genKeypair
- genPrivKey
- genPubKey
- genRandomBabyJubValue
- genRandomSalt
- genTreeCommitment
- genTreeProof
- hash13
- hash2
- hash3
- hash4
- hash5
- hashLeftRight
- hashN
- hashOne
- packPubKey
- poseidonDecrypt
- poseidonDecryptWithoutCheck
- poseidonEncrypt
- sha256Hash
- sign
- stringifyBigInts
- unpackPubKey
- unstringifyBigInts
- verifySignature
Type Aliases
Ciphertext
Ƭ Ciphertext<N
>: N
[]
Type parameters
Name | Type |
---|---|
N | bigint |
Defined in
EcdhSharedKey
Ƭ EcdhSharedKey<N
>: [N
, N
]
Type parameters
Name | Type |
---|---|
N | bigint |
Defined in
Leaf
Ƭ Leaf: bigint
Defined in
PathElements
Ƭ PathElements: bigint
[][]
Defined in
Plaintext
Ƭ Plaintext<N
>: N
[]
Type parameters
Name | Type |
---|---|
N | bigint |
Defined in
Point
Ƭ Point<N
>: [N
, N
]
Type parameters
Name | Type |
---|---|
N | SnarkBigNumber |
Defined in
PrivKey
Ƭ PrivKey: SnarkBigNumber
Defined in
PubKey
Ƭ PubKey<N
>: [N
, N
]
Type parameters
Name | Type |
---|---|
N | bigint |
Defined in
Variables
NOTHING_UP_MY_SLEEVE
• Const
NOTHING_UP_MY_SLEEVE: bigint
Defined in
SNARK_FIELD_SIZE
• Const
SNARK_FIELD_SIZE: bigint
= r
Defined in
Functions
bigInt2Buffer
▸ bigInt2Buffer(i
): Buffer
Convert a BigInt to a Buffer
Parameters
Name | Type | Description |
---|---|---|
i | bigint | the bigint to convert |
Returns
Buffer
the buffer
Defined in
calcDepthFromNumLeaves
▸ calcDepthFromNumLeaves(hashLength
, numLeaves
): number
Calculate the depth of a tree given the number of leaves
Parameters
Name | Type | Description |
---|---|---|
hashLength | number | the hashing function param length |
numLeaves | number | how many leaves |
Returns
number
the depth
Defined in
deepCopyBigIntArray
▸ deepCopyBigIntArray(arr
): bigint
[]
Create a copy of a bigint array
Parameters
Name | Type | Description |
---|---|---|
arr | bigint [] | the array of bigints to copy |
Returns
bigint
[]
a deep copy of the array