Documentation
¶
Overview ¶
Package crypto provides cryptographic utilities and helper functions for the Vocdoni system. It includes functions for working with finite fields, serialization, and other cryptographic operations.
Index ¶
Constants ¶
const SignatureCircuitVariableLen = 32 // bytes
SignatureCircuitVariableLen is the standard size in bytes for serialized field elements
Variables ¶
This section is empty.
Functions ¶
func BigIntToBytesToSign ¶
BigIntToBytesToSign converts a big.Int to a byte slice, ensuring that the resulting byte slice has SignatureCircuitVariableLen bytes. If the byte slice is shorter than SerializedFieldSize, it prepends zeros until the length is equal to SerializedFieldSize. If the byte slice is longer, it truncates it to the last SerializedFieldSize bytes.
func BigIntToFFToSign ¶
BigIntToFFToSign transform the inputs bigInt to the field provided, if it is not done, the circuit will transform it during the witness calculation and the resulting hash will be different. Moreover, the input hash should be 32 bytes so if it is not, fill with zeros at the beginning of the bytes representation.
func BigToFF ¶
BigToFF function returns the finite field representation of the big.Int provided. It uses the curve scalar field to represent the provided number.
func PadToSign ¶
PadToSign pads the input byte slice to ensure it has a length of SignatureCircuitVariableLen bytes. If the input is shorter, it prepends zeros until the length is equal to SignatureCircuitVariableLen. If the input is longer, it truncates it to the last SignatureCircuitVariableLen bytes.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Blob‑evaluation proof (EIP‑4844 / Proto‑Danksharding)
|
Blob‑evaluation proof (EIP‑4844 / Proto‑Danksharding) |
|
csp package provides the basic methods to create and verify certificates of voters eligibility of a Credential Service Providers (CSP).
|
csp package provides the basic methods to create and verify certificates of voters eligibility of a Credential Service Providers (CSP). |
|
Package ecc provides an interface and implementations for elliptic curve cryptography operations.
|
Package ecc provides an interface and implementations for elliptic curve cryptography operations. |
|
bjj_iden3
Package bjj implements the BabyJubJub elliptic curve operations using the iden3 library.
|
Package bjj implements the BabyJubJub elliptic curve operations using the iden3 library. |
|
bn254
Package bn254 implements the BN254 elliptic curve operations.
|
Package bn254 implements the BN254 elliptic curve operations. |
|
format
Package format provides helper functions to transform points (x, y) from TwistedEdwards to Reduced TwistedEdwards and vice versa.
|
Package format provides helper functions to transform points (x, y) from TwistedEdwards to Reduced TwistedEdwards and vice versa. |
|
Chaum-Pedersen NIZK proof of correct ElGamal decryption
|
Chaum-Pedersen NIZK proof of correct ElGamal decryption |
|
hash
|
|
|
poseidon
Package poseidon provides cryptographic hash functions based on the Poseidon hash algorithm.
|
Package poseidon provides cryptographic hash functions based on the Poseidon hash algorithm. |
|
signatures
|
|
|
ethereum
Package ethereum provides cryptographic operations for Ethereum ECDSA signatures.
|
Package ethereum provides cryptographic operations for Ethereum ECDSA signatures. |