Documentation
¶
Index ¶
- Constants
- func BigToBytes(bi *big.Int) []byte
- func RequireCanonicalInfinity(b []byte, isInfinity bool, canonical func() []byte)
- func SetBytesExact(b []byte, size int, setBytes func([]byte) (int, error))
- type BaseZr
- func (b *BaseZr) BigInt() *big.Int
- func (b *BaseZr) Bytes() []byte
- func (b *BaseZr) Clone(a driver.Zr)
- func (b *BaseZr) Copy() driver.Zr
- func (b *BaseZr) Equals(p driver.Zr) bool
- func (b *BaseZr) InvModOrder()
- func (b *BaseZr) InvModP(p driver.Zr)
- func (b *BaseZr) IsOne() bool
- func (b *BaseZr) IsZero() bool
- func (b *BaseZr) Minus(a driver.Zr) driver.Zr
- func (b *BaseZr) Mod(a driver.Zr)
- func (b *BaseZr) Mul(a driver.Zr) driver.Zr
- func (b *BaseZr) Neg()
- func (b *BaseZr) Plus(a driver.Zr) driver.Zr
- func (b *BaseZr) PowMod(x driver.Zr) driver.Zr
- func (b *BaseZr) String() string
- type CurveBase
- func (c *CurveBase) GroupOrder() driver.Zr
- func (c *CurveBase) HashToZr(data []byte) driver.Zr
- func (c *CurveBase) ModAdd(a1, b1, m driver.Zr) driver.Zr
- func (p *CurveBase) ModAddMul(a1 []driver.Zr, b1 []driver.Zr, modulo driver.Zr) driver.Zr
- func (p *CurveBase) ModAddMul2(a1 driver.Zr, c1 driver.Zr, b1 driver.Zr, c2 driver.Zr, m driver.Zr) driver.Zr
- func (p *CurveBase) ModAddMul2InPlace(result driver.Zr, a1, c1, b1, c2, m driver.Zr)
- func (p *CurveBase) ModAddMul3(a1 driver.Zr, a2 driver.Zr, b1 driver.Zr, b2 driver.Zr, c1 driver.Zr, ...) driver.Zr
- func (p *CurveBase) ModAddMul3InPlace(result driver.Zr, a1, a2, b1, b2, c1, c2, m driver.Zr)
- func (c *CurveBase) ModMul(a1, b1, m driver.Zr) driver.Zr
- func (p *CurveBase) ModMulInPlace(result, a, b, m driver.Zr)
- func (c *CurveBase) ModNeg(a1, m driver.Zr) driver.Zr
- func (c *CurveBase) ModSub(a1, b1, m driver.Zr) driver.Zr
- func (c *CurveBase) NewRandomZr(rng io.Reader) driver.Zr
- func (c *CurveBase) NewZrFromBigInt(i *big.Int) driver.Zr
- func (c *CurveBase) NewZrFromBytes(b []byte) driver.Zr
- func (c *CurveBase) NewZrFromInt64(i int64) driver.Zr
- func (c *CurveBase) NewZrFromUint64(i uint64) driver.Zr
- func (p *CurveBase) Rand() (io.Reader, error)
Constants ¶
const ScalarByteSize = 32
Variables ¶
This section is empty.
Functions ¶
func BigToBytes ¶
func RequireCanonicalInfinity ¶ added in v0.4.0
RequireCanonicalInfinity panics if a decoded identity was not given in its canonical encoding. gnark-crypto's BLS12 decoders also accept an all-zero uncompressed buffer as the identity.
func SetBytesExact ¶ added in v0.4.0
SetBytesExact decodes b with setBytes (typically a gnark-crypto SetBytes method, which returns the number of bytes consumed) and panics unless b is exactly size bytes long and setBytes consumed all of it.
gnark-crypto's point decoders accept buffers longer than the encoding and ignore the trailing bytes, and select the compressed or uncompressed format from the flag bits of the first byte. Requiring len(b) == size and full consumption makes decoding injective and pins the format to the one the caller asked for (see also RequireCanonicalInfinity). On-curve and subgroup checks are left to setBytes.
Types ¶
type BaseZr ¶ added in v0.1.0
func NewBaseZrFromBytesCanonical ¶ added in v0.4.0
NewBaseZrFromBytesCanonical decodes b as a big-endian scalar modulo modulus and returns an error unless len(b) == ScalarByteSize and the encoded value is strictly smaller than modulus, i.e. unless b is the (unique) encoding that Bytes produces for that scalar. Drivers whose Zr type is BaseZr use it to implement driver.CanonicalZrDecoder.
func (*BaseZr) Equals ¶ added in v0.1.0
Equals reports whether b and p represent the same residue modulo the group order.
func (*BaseZr) InvModOrder ¶ added in v0.1.0
func (b *BaseZr) InvModOrder()