| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Voting.Protocol.Tally
Contents
Synopsis
- data Tally c = Tally {}
- type EncryptedTally c = [[Encryption c]]
- encryptedTally :: Reifies c FFC => [Ballot c] -> (EncryptedTally c, Natural)
- emptyEncryptedTally :: Reifies c FFC => (EncryptedTally c, Natural)
- insertEncryptedTally :: Reifies c FFC => Ballot c -> (EncryptedTally c, Natural) -> (EncryptedTally c, Natural)
- type DecryptionShareCombinator c = EncryptedTally c -> [DecryptionShare c] -> Except ErrorTally [[DecryptionFactor c]]
- proveTally :: Reifies c FFC => (EncryptedTally c, Natural) -> [DecryptionShare c] -> DecryptionShareCombinator c -> Except ErrorTally (Tally c)
- verifyTally :: Reifies c FFC => Tally c -> DecryptionShareCombinator c -> Except ErrorTally ()
- newtype DecryptionShare c = DecryptionShare {
- unDecryptionShare :: [[(DecryptionFactor c, Proof c)]]
- type DecryptionFactor = G
- proveDecryptionShare :: Monad m => Reifies c FFC => RandomGen r => EncryptedTally c -> SecretKey c -> StateT r m (DecryptionShare c)
- proveDecryptionFactor :: Monad m => Reifies c FFC => RandomGen r => SecretKey c -> Encryption c -> StateT r m (DecryptionFactor c, Proof c)
- decryptionShareStatement :: Reifies c FFC => PublicKey c -> ByteString
- data ErrorTally
- verifyDecryptionShare :: Monad m => Reifies c FFC => EncryptedTally c -> PublicKey c -> DecryptionShare c -> ExceptT ErrorTally m ()
- verifyDecryptionShareByTrustee :: Monad m => Reifies c FFC => EncryptedTally c -> [PublicKey c] -> [DecryptionShare c] -> ExceptT ErrorTally m ()
Type Tally
Constructors
| Tally | |
Fields
| |
Instances
| Eq (Tally c) Source # | |
| Show (Tally c) Source # | |
| Generic (Tally c) Source # | |
| Reifies c FFC => ToJSON (Tally c) Source # | |
Defined in Voting.Protocol.Tally | |
| Reifies c FFC => FromJSON (Tally c) Source # | |
| NFData (Tally c) Source # | |
Defined in Voting.Protocol.Tally | |
| type Rep (Tally c) Source # | |
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 #
(
returns the sum of the encryptedTally ballots)Encryptions of the given ballots,
along with the number of Ballots.
emptyEncryptedTally :: Reifies c FFC => (EncryptedTally c, Natural) Source #
The initial EncryptedTally which tallies no Ballot.
insertEncryptedTally :: Reifies c FFC => Ballot c -> (EncryptedTally c, Natural) -> (EncryptedTally c, Natural) Source #
(
returns the insertEncryptedTally ballot encTally)EncryptedTally adding the votes of the given (ballot)
to those of the given (encTally).
Type DecryptionShareCombinator
type DecryptionShareCombinator c = EncryptedTally c -> [DecryptionShare c] -> Except ErrorTally [[DecryptionFactor c]] Source #
proveTally :: Reifies c FFC => (EncryptedTally c, Natural) -> [DecryptionShare c] -> DecryptionShareCombinator c -> Except ErrorTally (Tally c) Source #
verifyTally :: Reifies c FFC => Tally c -> DecryptionShareCombinator c -> Except ErrorTally () Source #
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 | |
Fields
| |
Type DecryptionFactor
type DecryptionFactor = G Source #
encryption_nonce^trusteeSecKey
proveDecryptionShare :: Monad m => Reifies c FFC => RandomGen r => EncryptedTally c -> SecretKey c -> StateT r m (DecryptionShare c) Source #
proveDecryptionFactor :: Monad m => Reifies c FFC => RandomGen r => SecretKey c -> Encryption c -> StateT r m (DecryptionFactor c, Proof c) Source #
decryptionShareStatement :: Reifies c FFC => PublicKey c -> ByteString Source #
Type ErrorTally
data ErrorTally Source #
Constructors
| ErrorTally_NumberOfQuestions | The number of |
| 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 |
| ErrorTally_CannotDecryptCount | Raised by |
Instances
| Eq ErrorTally Source # | |
Defined in Voting.Protocol.Tally | |
| Show ErrorTally Source # | |
Defined in Voting.Protocol.Tally Methods showsPrec :: Int -> ErrorTally -> ShowS # show :: ErrorTally -> String # showList :: [ErrorTally] -> ShowS # | |
| Generic ErrorTally Source # | |
Defined in Voting.Protocol.Tally Associated Types type Rep ErrorTally :: Type -> Type # | |
| NFData ErrorTally Source # | |
Defined in Voting.Protocol.Tally Methods rnf :: ErrorTally -> () # | |
| type Rep ErrorTally Source # | |
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 #
(
checks that verifyDecryptionShare encTally trusteePubKey trusteeDecShare)trusteeDecShare
(supposedly submitted by a trustee whose PublicKey is trusteePubKey)
is valid with respect to the EncryptedTally encTally.
verifyDecryptionShareByTrustee :: Monad m => Reifies c FFC => EncryptedTally c -> [PublicKey c] -> [DecryptionShare c] -> ExceptT ErrorTally m () Source #