Skip to content

Commit

Permalink
impl Display for Pedersen commitment and grouped ElGamal ciphertext…
Browse files Browse the repository at this point in the history
… pod types
  • Loading branch information
samkim-crypto committed Sep 3, 2024
1 parent 56ba5a5 commit 5cbc181
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zk-sdk/src/encryption/pod/grouped_elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ impl Default for PodGroupedElGamalCiphertext2Handles {
}
}

impl fmt::Display for PodGroupedElGamalCiphertext2Handles {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", BASE64_STANDARD.encode(self.0))
}
}

impl_from_str!(
TYPE = PodGroupedElGamalCiphertext2Handles,
BYTES_LEN = GROUPED_ELGAMAL_CIPHERTEXT_2_HANDLES,
Expand Down Expand Up @@ -135,6 +141,12 @@ impl Default for PodGroupedElGamalCiphertext3Handles {
}
}

impl fmt::Display for PodGroupedElGamalCiphertext3Handles {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", BASE64_STANDARD.encode(self.0))
}
}

impl_from_str!(
TYPE = PodGroupedElGamalCiphertext3Handles,
BYTES_LEN = GROUPED_ELGAMAL_CIPHERTEXT_3_HANDLES,
Expand Down
6 changes: 6 additions & 0 deletions zk-sdk/src/encryption/pod/pedersen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ impl From<PedersenCommitment> for PodPedersenCommitment {
}
}

impl fmt::Display for PodPedersenCommitment {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", BASE64_STANDARD.encode(self.0))
}
}

impl_from_str!(
TYPE = PodPedersenCommitment,
BYTES_LEN = PEDERSEN_COMMITMENT_LEN,
Expand Down

0 comments on commit 5cbc181

Please sign in to comment.