Skip to content

Commit

Permalink
argon2: impl Debug for Argon2 (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoDmitry committed Jun 14, 2023
1 parent 64d7004 commit eccda35
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions argon2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub use {

use crate::blake2b_long::blake2b_long;
use blake2::{digest, Blake2b512, Digest};
use core::fmt;

#[cfg(all(feature = "alloc", feature = "password-hash"))]
use password_hash::{Decimal, Ident, ParamsString, Salt};
Expand Down Expand Up @@ -172,6 +173,16 @@ impl Default for Argon2<'_> {
}
}

impl fmt::Debug for Argon2<'_> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Argon2")
.field("algorithm", &self.algorithm)
.field("version", &self.version)
.field("params", &self.params)
.finish_non_exhaustive()
}
}

impl<'key> Argon2<'key> {
/// Create a new Argon2 context.
pub fn new(algorithm: Algorithm, version: Version, params: Params) -> Self {
Expand Down

0 comments on commit eccda35

Please sign in to comment.