Skip to content

Commit

Permalink
add OutputHash::verify
Browse files Browse the repository at this point in the history
Users could already do this manually, but it's nicer to have a properly
named function that exposes this very common operation.
  • Loading branch information
Freax13 committed Nov 2, 2024
1 parent bcf221f commit 9af0541
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions host/mushroom-verify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ impl OutputHash {
len: output.len() as u64,
}
}

/// Verify that the hash matches the byte slice.
pub fn verify(&self, output: &[u8]) -> bool {
*self == Self::new(output)
}
}

impl From<OutputHash> for HashedInput {
Expand Down

0 comments on commit 9af0541

Please sign in to comment.