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

Safe HaskellNone
LanguageHaskell2010

Voting.Protocol.Tally

Contents

Synopsis

Type Tally

data Tally q Source #

Constructors

Tally 

Fields

Instances
Eq (Tally q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

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

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

Show (Tally q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

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

show :: Tally q -> String #

showList :: [Tally q] -> ShowS #

Generic (Tally q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Associated Types

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

Methods

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

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

NFData (Tally q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

rnf :: Tally q -> () #

type Rep (Tally q) Source # 
Instance details

Defined in Voting.Protocol.Tally

type Rep (Tally q) = D1 (MetaData "Tally" "Voting.Protocol.Tally" "hjugement-protocol-0.0.0.20190513-FHCeTArdaCC2IRctq0Wzr8" False) (C1 (MetaCons "Tally" PrefixI True) ((S1 (MetaSel (Just "tally_countMax") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Natural) :*: S1 (MetaSel (Just "tally_encByChoiceByQuest") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (EncryptedTally q))) :*: (S1 (MetaSel (Just "tally_decShareByTrustee") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [DecryptionShare q]) :*: S1 (MetaSel (Just "tally_countByChoiceByQuest") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[Natural]]))))

Type EncryptedTally

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

Encryption by Choice by Question.

encryptedTally :: SubGroup q => [Ballot q] -> (EncryptedTally q, Natural) Source #

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

Type DecryptionShareCombinator

Type DecryptionShare

data DecryptionShare q Source #

A decryption share. It is computed by a trustee from its SecretKey share and the EncryptedTally, and contains a cryptographic Proof that it hasn't cheated.

Instances
Eq (DecryptionShare q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Show (DecryptionShare q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Generic (DecryptionShare q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Associated Types

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

NFData (DecryptionShare q) Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

rnf :: DecryptionShare q -> () #

type Rep (DecryptionShare q) Source # 
Instance details

Defined in Voting.Protocol.Tally

type Rep (DecryptionShare q) = D1 (MetaData "DecryptionShare" "Voting.Protocol.Tally" "hjugement-protocol-0.0.0.20190513-FHCeTArdaCC2IRctq0Wzr8" False) (C1 (MetaCons "DecryptionShare" PrefixI True) (S1 (MetaSel (Just "decryptionShare_factors") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[DecryptionFactor q]]) :*: S1 (MetaSel (Just "decryptionShare_proofs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [[Proof q]])))

Type DecryptionFactor

Type ErrorDecryptionShare

data ErrorDecryptionShare Source #

Constructors

ErrorDecryptionShare_Invalid Text

The number of DecryptionFactors or the number of Proofs is not the same or not the expected number.

ErrorDecryptionShare_Wrong

The Proof of a DecryptionFactor is wrong.

ErrorDecryptionShare_InvalidMaxCount 
Instances
Eq ErrorDecryptionShare Source # 
Instance details

Defined in Voting.Protocol.Tally

Show ErrorDecryptionShare Source # 
Instance details

Defined in Voting.Protocol.Tally

Generic ErrorDecryptionShare Source # 
Instance details

Defined in Voting.Protocol.Tally

Associated Types

type Rep ErrorDecryptionShare :: Type -> Type #

NFData ErrorDecryptionShare Source # 
Instance details

Defined in Voting.Protocol.Tally

Methods

rnf :: ErrorDecryptionShare -> () #

type Rep ErrorDecryptionShare Source # 
Instance details

Defined in Voting.Protocol.Tally

type Rep ErrorDecryptionShare = D1 (MetaData "ErrorDecryptionShare" "Voting.Protocol.Tally" "hjugement-protocol-0.0.0.20190513-FHCeTArdaCC2IRctq0Wzr8" False) (C1 (MetaCons "ErrorDecryptionShare_Invalid" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)) :+: (C1 (MetaCons "ErrorDecryptionShare_Wrong" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "ErrorDecryptionShare_InvalidMaxCount" PrefixI False) (U1 :: Type -> Type)))

verifyDecryptionShare :: Monad m => SubGroup q => EncryptedTally q -> PublicKey q -> DecryptionShare q -> ExceptT ErrorDecryptionShare 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.