hjugement-protocol-0.0.4.20190711: A cryptographic protocol for the Majority Judgment.

Safe HaskellNone
LanguageHaskell2010

Voting.Protocol.Tally

Contents

Synopsis

Type Tally

data Tally c Source #

Constructors

Tally 

Fields

Instances
Eq (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

(==) :: Tally c -> Tally c -> Bool #

(/=) :: Tally c -> Tally c -> Bool #

Show (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

showsPrec :: Int -> Tally c -> ShowS #

show :: Tally c -> String #

showList :: [Tally c] -> ShowS #

Generic (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Associated Types

type Rep (Tally c) :: Type -> Type #

Methods

from :: Tally c -> Rep (Tally c) x #

to :: Rep (Tally c) x -> Tally c #

Reifies c FFC => ToJSON (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Reifies c FFC => FromJSON (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

NFData (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

rnf :: Tally c -> () #

type Rep (Tally c) Source # 
Instance details

Defined in Voting.Protocol.Tally

type Rep (Tally c) = D1 (MetaData "Tally" "Voting.Protocol.Tally" "hjugement-protocol-0.0.4.20190711-9XKUqaKqeIWGSUJTM0D5D" False) (C1 (MetaCons "Tally" PrefixI True) ((S1 (MetaSel (Just "tally_countMax") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Natural) :*: S1 (MetaSel (Just "tally_encByChoiceByQuest") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (EncryptedTally c))) :*: (S1 (MetaSel (Just "tally_decShareByTrustee") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [DecryptionShare c]) :*: S1 (MetaSel (Just "tally_countByChoiceByQuest") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 [[Natural]]))))

Type EncryptedTally

type EncryptedTally c = [[Encryption c]] Source #

Encryption by choice by Question.

encryptedTally :: Reifies c FFC => [Ballot c] -> (EncryptedTally c, Natural) Source #

(encryptedTally ballots) returns the sum of the Encryptions of the given ballots, along with the number of Ballots.

insertEncryptedTally :: Reifies c FFC => Ballot c -> (EncryptedTally c, Natural) -> (EncryptedTally c, Natural) Source #

(insertEncryptedTally ballot encTally) returns the EncryptedTally adding the votes of the given (ballot) to those of the given (encTally).

Type DecryptionShareCombinator

Type DecryptionShare

newtype DecryptionShare c Source #

A decryption share is a DecryptionFactor and a decryption Proof, by choice by Question. Computed by a trustee in proveDecryptionShare.

Constructors

DecryptionShare 
Instances
Eq (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Show (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Generic (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Associated Types

type Rep (DecryptionShare c) :: Type -> Type #

ToJSON (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Reifies c FFC => FromJSON (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

NFData (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

rnf :: DecryptionShare c -> () #

type Rep (DecryptionShare c) Source # 
Instance details

Defined in Voting.Protocol.Tally

type Rep (DecryptionShare c) = D1 (MetaData "DecryptionShare" "Voting.Protocol.Tally" "hjugement-protocol-0.0.4.20190711-9XKUqaKqeIWGSUJTM0D5D" True) (C1 (MetaCons "DecryptionShare" PrefixI True) (S1 (MetaSel (Just "unDecryptionShare") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[(DecryptionFactor c, Proof c)]])))

Type DecryptionFactor

Type ErrorTally

data ErrorTally Source #

Constructors

ErrorTally_NumberOfQuestions

The number of Questions is not the one expected.

ErrorTally_NumberOfChoices

The number of choices is not the one expected.

ErrorTally_NumberOfTrustees

The number of trustees is not the one expected.

ErrorTally_WrongProof

The Proof of a DecryptionFactor is wrong.

ErrorTally_CannotDecryptCount

Raised by proveTally when the discrete logarithm of groupGen ^count cannot be computed, likely because tally_countMax is wrong, or because the EncryptedTally or DecryptionShares have not been verified.

Instances
Eq ErrorTally Source # 
Instance details

Defined in Voting.Protocol.Tally

Show ErrorTally Source # 
Instance details

Defined in Voting.Protocol.Tally

Generic ErrorTally Source # 
Instance details

Defined in Voting.Protocol.Tally

Associated Types

type Rep ErrorTally :: Type -> Type #

NFData ErrorTally Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

rnf :: ErrorTally -> () #

type Rep ErrorTally Source # 
Instance details

Defined in Voting.Protocol.Tally

type Rep ErrorTally = D1 (MetaData "ErrorTally" "Voting.Protocol.Tally" "hjugement-protocol-0.0.4.20190711-9XKUqaKqeIWGSUJTM0D5D" False) ((C1 (MetaCons "ErrorTally_NumberOfQuestions" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "ErrorTally_NumberOfChoices" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "ErrorTally_NumberOfTrustees" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "ErrorTally_WrongProof" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "ErrorTally_CannotDecryptCount" PrefixI False) (U1 :: Type -> Type))))

verifyDecryptionShare :: Monad m => Reifies c FFC => EncryptedTally c -> PublicKey c -> DecryptionShare c -> ExceptT ErrorTally m () Source #

(verifyDecryptionShare encTally trusteePubKey trusteeDecShare) checks that trusteeDecShare (supposedly submitted by a trustee whose PublicKey is trusteePubKey) is valid with respect to the EncryptedTally encTally.