crypto

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

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

View Source
const SignatureCircuitVariableLen = 32 // bytes

SignatureCircuitVariableLen is the standard size in bytes for serialized field elements

Variables

This section is empty.

Functions

func BigIntToBytesToSign

func BigIntToBytesToSign(input *big.Int) []byte

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

func BigIntToFFToSign(input, field *big.Int) []byte

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

func BigToFF(field, iv *big.Int) *big.Int

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

func PadToSign(input []byte) []byte

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
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).
ecc
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
dkg
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL