Skip to content

Commit

Permalink
randomized: add Debug to structs (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
conradoplg authored Jun 6, 2024
1 parent 2f07dbc commit 9e19bc9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions frost-rerandomized/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rustdoc-args = ["--cfg", "docsrs"]
derive-getters = "0.4.0"
document-features = "0.2.7"
frost-core = { path = "../frost-core", version = "1.0.0", features = ["internals"] }
hex = "0.4.3"
rand_core = "0.6"

[dev-dependencies]
Expand Down
29 changes: 29 additions & 0 deletions frost-rerandomized/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,19 @@ where
}
}

impl<C> core::fmt::Debug for Randomizer<C>
where
C: Ciphersuite,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("Randomizer")
.field(&hex::encode(
<<C::Group as Group>::Field>::serialize(&self.0).as_ref(),
))
.finish()
}
}

/// Randomized parameters for a signing instance of randomized FROST.
#[derive(Clone, PartialEq, Eq, Getters)]
pub struct RandomizedParams<C: Ciphersuite> {
Expand Down Expand Up @@ -303,3 +316,19 @@ where
}
}
}

impl<C> core::fmt::Debug for RandomizedParams<C>
where
C: Ciphersuite,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("RandomizedParams")
.field("randomizer", &self.randomizer)
.field(
"randomizer_element",
&hex::encode(<C::Group as Group>::serialize(&self.randomizer_element).as_ref()),
)
.field("randomized_verifying_key", &self.randomized_verifying_key)
.finish()
}
}

0 comments on commit 9e19bc9

Please sign in to comment.