| Copyright | (c) Eric Crockett 2011-2017 Chris Peikert 2011-2017 |
|---|---|
| License | GPL-3 |
| Maintainer | ecrockett0@email.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.Lol.Gadget
Description
Interfaces for "gadgets," decomposition, and error correction.
Synopsis
- class Ring u => Gadget gad u where
- class (Gadget gad u, Reduce (DecompOf u) u) => Decompose gad u where
- class Gadget gad u => Correct gad u where
- decomposeList :: forall gad u. Decompose gad u => [u] -> [DecompOf u]
- decomposeMatrix :: forall gad u. Decompose gad u => Matrix u -> Matrix (DecompOf u)
- data TrivGad
- data BaseBGad b
Documentation
class Ring u => Gadget gad u where Source #
Gadget vectors, parameterized by an index type.
Minimal complete definition
Methods
The gadget vector over u.
Yield an error-tolerant encoding of an element with respect to the gadget. (Mathematically, this should just be the product of the input with the gadget, but it is a class method to allow for optimized implementations.)
Instances
| (Gadget gad a, Gadget gad b) => Gadget (gad :: k) (a, b) Source # | Product ring: concatenate gadgets over component rings |
| (Gadget gad (Cyc t m a), Gadget gad (Cyc t m b)) => Gadget (gad :: k) (Cyc t m (a, b)) Source # | |
| Gadget gad (CycG t m (ZqBasic q z)) => Gadget (gad :: k2) (Cyc t m (ZqBasic q z)) Source # | |
| (Reflects q z, ToInteger z) => Gadget TrivGad (ZqBasic q z) Source # | |
| (Reflects q z, ToInteger z, RealIntegral z, Reflects b z) => Gadget (BaseBGad b :: Type) (ZqBasic q z) Source # | |
class (Gadget gad u, Reduce (DecompOf u) u) => Decompose gad u where Source #
Decomposition relative to a gadget.
Methods
decompose :: u -> [DecompOf u] Source #
Yield a short vector \( x \) such that \( \langle g, x\rangle = u \).
Instances
| (Decompose gad a, Decompose gad b, DecompOf a ~ DecompOf b) => Decompose (gad :: k) (a, b) Source # | Product ring: concatenate decompositions for component rings |
| (Decompose gad (Cyc t m a), Decompose gad (Cyc t m b), DecompOf (Cyc t m a) ~ DecompOf (Cyc t m b), Reduce (DecompOf (Cyc t m a)) (Cyc t m (a, b))) => Decompose (gad :: k) (Cyc t m (a, b)) Source # | |
| (Decompose gad (CycG t m (ZqBasic q Int64)), Reduce (Cyc t m Int64) (Cyc t m (ZqBasic q Int64))) => Decompose (gad :: k2) (Cyc t m (ZqBasic q Int64)) Source # | |
| (Reflects q z, ToInteger z) => Decompose TrivGad (ZqBasic q z) Source # | |
| (Reflects q z, ToInteger z, Reflects b z) => Decompose (BaseBGad b :: Type) (ZqBasic q z) Source # | |
class Gadget gad u => Correct gad u where Source #
Error correction relative to a gadget.
Methods
correct :: [u] -> (u, [LiftOf u]) Source #
Error-correct a "noisy" encoding of an element (see encode),
returning the encoded element and the error vector.
Instances
| (Correct gad a, Correct gad b, Mod a, Mod b, Field a, Field b, Lift' a, Lift' b, ToInteger (LiftOf a), ToInteger (LiftOf b)) => Correct (gad :: k) (a, b) Source # | Product ring |
Defined in Crypto.Lol.Gadget | |
| Correct gad (CycG t m (ZqBasic q Int64)) => Correct (gad :: k2) (Cyc t m (ZqBasic q Int64)) Source # | |
| (Reflects q z, ToInteger z, Ring z) => Correct TrivGad (ZqBasic q z) Source # | |
| (Reflects q z, ToInteger z, Reflects b z) => Correct (BaseBGad b :: Type) (ZqBasic q z) Source # | |
decomposeList :: forall gad u. Decompose gad u => [u] -> [DecompOf u] Source #
Decompose a list entry-wise.
decomposeMatrix :: forall gad u. Decompose gad u => Matrix u -> Matrix (DecompOf u) Source #
Decompose a matrix entry-wise.
Dummy type representing the gadget \( [1] \).
Dummy type representing the gadget \( [1,b,b^2,\ldots] \).
Instances
| (Reflects q z, ToInteger z, Reflects b z) => Correct (BaseBGad b :: Type) (ZqBasic q z) Source # | |
| (Reflects q z, ToInteger z, Reflects b z) => Decompose (BaseBGad b :: Type) (ZqBasic q z) Source # | |
| (Reflects q z, ToInteger z, RealIntegral z, Reflects b z) => Gadget (BaseBGad b :: Type) (ZqBasic q z) Source # | |
| Reflects b Integer => Show (ArgType (BaseBGad b)) Source # | |