Documentation
¶
Overview ¶
Package zkbpp implement a ZKCE with preprocessing based on CHASE, Melissa, et al. Post-quantum zero-knowledge and signatures from symmetric-key primitives. BAUM, Carsten et NOF, Ariel. Concretely-efficient zero-knowledge arguments for arithmetic circuits and their application to lattice-based cryptography.
Index ¶
- Constants
- func Copy(src *big.Int) (dst *big.Int)
- func DefaultParamsCRISP() *ckks.Parameters
- func Preprocess(c *Circuit, input []ZKBVar, nbIterations int) (ctx *KKWContext, p KKWProof)
- func PreprocessChallenge(nbIterations, nbOpenings int) (openList, closedList []uint32)
- func Prove(c *Circuit, input []ZKBVar, ctx *KKWContext, ...) (p ZKBProof, output []ZKBVar)
- func Reduce32(x *big.Int) (z *big.Int)
- func RightRotate32(x *big.Int, n uint) (z *big.Int)
- func Verify(p ZKBProof, kkwP KKWProof, challengesIndex, closedIndex []uint32) bool
- func Xor(xs ...*big.Int) (z *big.Int)
- type Circuit
- func (c *Circuit) CKKSDecrypt(ct0, ct1 *lr.Poly, sk *lr.Poly) (pt *lr.Poly)
- func (c *Circuit) CopyVar(v ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcAdd(x ZKBVar, y ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcAddK(x ZKBVar, k *big.Int) (z ZKBVar)
- func (c *Circuit) MpcBdop(rc []ZKBVar, r0, e0, e1 ZKBVar, a1, a2 [][]*lr.Poly) (c1, c2 []ZKBVar)
- func (c *Circuit) MpcBitDec(x ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcCKKSEncrypt(pt, r0, e0, e1 ZKBVar, pk [2]*lr.Poly) (ct0, ct1 ZKBVar)
- func (c *Circuit) MpcCRISP(r0, e0, e1 ZKBVar, message, rc []ZKBVar, a1, a2 [][]*lr.Poly, pk [2]*lr.Poly) (ct0, ct1 ZKBVar, bdop1, bdop2 []ZKBVar, h []ZKBVar)
- func (c *Circuit) MpcMult(x ZKBVar, y ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcMultK(x ZKBVar, k *big.Int) (z ZKBVar)
- func (c *Circuit) MpcRqAdd(x ZKBVar, y ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcRqAddK(x ZKBVar, k *lr.Poly) (z ZKBVar)
- func (c *Circuit) MpcRqMultK(x ZKBVar, k *lr.Poly) (z ZKBVar)
- func (c *Circuit) MpcSub(x ZKBVar, y ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcSubK(x ZKBVar, k *big.Int) (z ZKBVar)
- func (c *Circuit) MpcZ2Add(x, y ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcZ2AddK(x ZKBVar, k *big.Int) (z ZKBVar)
- func (c *Circuit) MpcZ2And(x, y ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcZ2Not(x ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcZ2RightShift(x ZKBVar, i uint) (z ZKBVar)
- func (circ *Circuit) MpcZ2Sha(x ZKBVar) (z ZKBVar)
- func (circ *Circuit) MpcZ2ShaFast(x ZKBVar) (z ZKBVar)
- func (c *Circuit) MpcZ2Xor(x, y ZKBVar) (z ZKBVar)
- func (c *Circuit) RqVar(coeffs []uint64) ZKBVar
- func (c *Circuit) RqVarFromZqArray(coeffs []ZKBVar) ZKBVar
- func (c *Circuit) SetDescription(d CircuitDescription)
- func (circ *Circuit) Sha(x *big.Int) (z *big.Int)
- func (c *Circuit) Var(x *big.Int) ZKBVar
- func (c *Circuit) VarFromPoly(x *lr.Poly) []ZKBVar
- func (c *Circuit) VarUint64(x uint64) ZKBVar
- func (c *Circuit) Z2Var(value string) ZKBVar
- type CircuitDescription
- type KKWContext
- type KKWProof
- type ZKBProof
- type ZKBVar
Constants ¶
const SECURITY_LEVEL = 16
Security level of seeds, in bytes. 128 bits = 16 bytes, 256 bits = 32 bytes
Variables ¶
This section is empty.
Functions ¶
func DefaultParamsCRISP ¶
func DefaultParamsCRISP() *ckks.Parameters
DefaultParamsCRISP returns the default parameters of a CKKS scheme
func Preprocess ¶
func Preprocess(c *Circuit, input []ZKBVar, nbIterations int) (ctx *KKWContext, p KKWProof)
Preprocess runs the preprocessing of a ZKB++ proof on a circuit c with input input for nbIterations. Returns a KKWContext for the main proof, and a KKWProof for the preprocessing commitment
func PreprocessChallenge ¶
PreprocessChallenge generates the list of index for closed and open iterations for the preprocessing, given the number of iterations needed for each. Used by the verifier
func Prove ¶
func Prove(c *Circuit, input []ZKBVar, ctx *KKWContext, challengesIndex, closedIndex []uint32) (p ZKBProof, output []ZKBVar)
Prove computes the ZKB++ proof of circuit c, given input input, KKWContext ctx, and the list of open and closed iterations. Returns a ZKBProof and the output of circuit.
func RightRotate32 ¶
RightRotate32 rotates a bigInt x for n positions, wrapping after 32 bits meant to operate on SHA word, i.e 32 bits. Will fail for other big int
Types ¶
type Circuit ¶
type Circuit struct { Description CircuitDescription //rings Rq *lr.Ring *cr.Ring // contains filtered or unexported fields }
Circuit is a struct representing a circuit for ZKCE
func NewCircuit ¶
NewCircuit instantiates a new circuit with given ring
func (*Circuit) CKKSDecrypt ¶
CKKSDecrypt decrypt ct0 and ct1 with secret key sk
func (*Circuit) MpcBdop ¶
MpcBdop computes the BDOP commitment for r0, e0, e1, given secret parameters rc and public matrices a1 and a2 MpcBdop will panic if the dimension of a1,a2 and rc does not match
func (*Circuit) MpcBitDec ¶
MpcBitdec transforms a additive secrect sharing into a XOR secrect sharing Use to go from ring Zq to ring Z2
func (*Circuit) MpcCKKSEncrypt ¶
MpcCKKSEncrypt encrypt pt with public key, using encryption noise r0,e0 and e1 pt should be a ZKBVar with shares in Rq ct0 and ct1 are ZKBVar with shares in Rq
func (*Circuit) MpcCRISP ¶
func (c *Circuit) MpcCRISP(r0, e0, e1 ZKBVar, message, rc []ZKBVar, a1, a2 [][]*lr.Poly, pk [2]*lr.Poly) (ct0, ct1 ZKBVar, bdop1, bdop2 []ZKBVar, h []ZKBVar)
MpcCRISP runs the CRISP circuit
func (*Circuit) MpcRqMultK ¶
MpcRqMultK multiplies poly x to constant k and returns the result
func (*Circuit) MpcZ2RightShift ¶
MpcZ2RightShift rightshift var x by i and returns the result
func (*Circuit) MpcZ2Sha ¶
MpcZ2Sha compute the SHA-256 of X in a mpc manner. Note that the output value has a bitlen of 256, independent of log(Q)
func (*Circuit) MpcZ2ShaFast ¶
MpcZ2ShaFast compute the SHA-256 of X in a mpc manner, using uint32 for shorter runtime. Note that the output value has a bitlen of 256, independent of log(Q)
func (*Circuit) RqVarFromZqArray ¶
RQVarFromZqArray transforms an array of ZKBVar with shares in Zq into a ZKBVar with shares in Rq
func (*Circuit) SetDescription ¶
func (c *Circuit) SetDescription(d CircuitDescription)
SetDescription sets the description of circuit c to d
func (*Circuit) VarFromPoly ¶
VarFromPoly transforms a poly into an array of ZKBVar with value in Zq
type CircuitDescription ¶
CircuitDescription represents a function acting as a Circuit description
type KKWContext ¶
type KKWContext struct {
// contains filtered or unexported fields
}
KKWContext is a struct holding the information needed from the preprocessing phase
type KKWProof ¶
type KKWProof struct {
// contains filtered or unexported fields
}
KKWProof is a struct holding the first round of commitment for a cut & choose protocol