| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Voting.Protocol.FFC
Description
Finite Field Cryptography (FFC) is a method of implementing discrete logarithm cryptography using finite field mathematics.
Synopsis
- data FFC = FFC {
- ffc_name :: Text
- ffc_fieldCharac :: !Natural
- ffc_groupGen :: !Natural
- ffc_groupOrder :: !Natural
- fieldCharac :: forall c. Reifies c FFC => Natural
- weakFFC :: FFC
- beleniosFFC :: FFC
- newtype F c = F {}
Type FFC
Mutiplicative Sub-Group of a Finite Prime Field.
NOTE: an FFC term-value is brought into the context of many functions
through a type-variable c whose Reifies constraint enables to reflect
that FFC at the term-level (a surprising technique but a very useful one).
Doing like this is simpler than working in a Monad (like a Reader),
and enables that FFC term to be used simply in instances' methods
not supporting an inner Monad, like parseJSON, randomR, fromEnum or arbitrary.
Aside from that, the sharing of FFC amongst several types
is encoded at the type-level by including c
as a phantom type of F, G and E.
Constructors
| FFC | |
Fields
| |
Instances
Examples
beleniosFFC :: FFC Source #
Parameters used in Belenios.
A 2048-bit fieldCharac of a Finite Prime Field,
with a 256-bit groupOrder for a Multiplicative subgroup
generated by groupGen.
Type F
The type of the elements of a Finite Prime Field.
A field must satisfy the following properties:
(f, (forms an abelian group, called the+),zero)Additivegroup off.(forms an abelian group, called theNonNullf, (*),one)Multiplicativegroup off.- (
*) is associative:(aand*b)*c == a*(b*c)a.*(b*c) == (a*b)*c - (
*) and (+) are both commutative:aand*b == b*aa+b == b+a - (
*) and (+) are both left and right distributive:aand*(b+c) == (a*b)+(a*c)(a+b)*c == (a*c)+(b*c)
The Natural is always within [0...fieldCharac-1]
Instances
| Eq (F c) Source # | |
| Ord (F c) Source # | |
| Show (F c) Source # | |
| ToJSON (F c) Source # | |
Defined in Voting.Protocol.FFC | |
| Reifies c FFC => FromJSON (F c) Source # | |
| NFData (F c) Source # | |
Defined in Voting.Protocol.FFC | |
| Reifies c FFC => Random (F c) Source # | |
| ToNatural (F c) Source # | |
| Reifies c FFC => FromNatural (F c) Source # | |
Defined in Voting.Protocol.FFC Methods fromNatural :: Natural -> F c Source # | |
| Reifies c FFC => Multiplicative (F c) Source # | |
| Reifies c FFC => Negable (F c) Source # | |
| Reifies c FFC => Additive (F c) Source # | |