gnark-crypto provides elliptic curve and pairing-based cryptography on BN, BLS12, BLS24 and BW6 curves. It also provides various algorithms (algebra, crypto) of particular interest to zero knowledge proof systems.
Apache License 2.0
495
stars
160
forks
source link
perf: add kzg.UnsafeToBytes and kzg.UnsafeFromBytes methods #499
TLDR; adds a method (no breaking changes) to kzg.SRS object that quickly dumps a binary representation without doing any checks, and optionally, enables to truncate the SRS at writing / reading time. UnsafeFromBytes is 6x time faster than UnsafeReadFrom
godoc:
// UnsafeToBytes returns the binary encoding of the entire SRS memory representation
// It is meant to be use to achieve fast serialization/deserialization and
// is not compatible with WriteTo / ReadFrom. It does not do any validation
// and doesn't encode points in a canonical form.
// @unstable: the format may change in the future
// If maxPkPoints is provided, the number of points in the ProvingKey will be limited to maxPkPoints
func (srs *SRS) UnsafeToBytes(maxPkPoints ...int) ([]byte, error) {
Description
TLDR; adds a method (no breaking changes) to
kzg.SRS
object that quickly dumps a binary representation without doing any checks, and optionally, enables to truncate the SRS at writing / reading time.UnsafeFromBytes
is 6x time faster thanUnsafeReadFrom
godoc:
benchmark, 1 <<24 points bls12377
Checklist: