electionguard icon indicating copy to clipboard operation
electionguard copied to clipboard

♻️ Hash of Manifest should include candidates

Open keithrfung opened this issue 3 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Suggestion

This is an update for documentation of hashing and proposing changes for 2.0.

The hash of the Manifest done in both languages does not include the contests. This seems like a necessity.

    def crypto_hash(self) -> ElementModQ:
        """
        Returns a hash of the metadata components of the election
        """
        hash = hash_elems(
            self.election_scope_id,
            str(self.type.name),
            to_iso_date_string(self.start_date),
            to_iso_date_string(self.end_date),
            self.name,
            self.contact_information,
            self.geopolitical_units,
            self.parties,
            self.contests,
            self.ballot_styles,
        )
        log_debug(f"{self.__class__} : crypto_hash: {hash.to_hex()}")
        return hash

Possible Implementation

No response

Anything else?

Original Issue by @JohnLCaron https://github.com/microsoft/electionguard-python/issues/523

keithrfung avatar Feb 16 '22 23:02 keithrfung

I think this should be

Hash of Manifest should include candidates

JohnLCaron avatar Mar 01 '22 22:03 JohnLCaron

@JohnLCaron Thanks for keeping me honest.

keithrfung avatar Mar 04 '22 16:03 keithrfung

Along the same lines, CandidateContestDescription does not include primary_party_ids in crypto_hash. For simplicity, one could remove CandidateContestDescription and include an optional primary_party_ids in ContestDescription.

JohnLCaron avatar Mar 18 '22 17:03 JohnLCaron

I think this is also something overall discussed for ElectionGuard 2.0

keithrfung avatar May 13 '22 14:05 keithrfung