Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vorot93 committed Jun 9, 2023
1 parent 3ed86bb commit ea0de56
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
[`fsb`]: ./fsb
[`gost94`]: ./gost94
[`groestl`]: ./groestl
[`jh`]: ./jh
[`k12`]: ./k12
[`md2`]: ./md2
[`md4`]: ./md4
Expand Down Expand Up @@ -283,6 +284,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
[FSB]: https://en.wikipedia.org/wiki/Fast_syndrome-based_hash
[GOST94]: https://en.wikipedia.org/wiki/GOST_(hash_function)
[Grøstl]: https://en.wikipedia.org/wiki/Grøstl
[JH]: https://www3.ntu.edu.sg/home/wuhj/research/jh
[KangarooTwelve]: https://keccak.team/kangarootwelve.html
[MD2]: https://en.wikipedia.org/wiki/MD2_(cryptography)
[MD4]: https://en.wikipedia.org/wiki/MD4
Expand Down
48 changes: 47 additions & 1 deletion jh/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
//! Implementation of JH cryptographic hash algorithms.
//! The JH hash function was one of the submissions to SHA-3,
//! the cryptographic hash algorithm competition organized by the NIST.
//!
//! There are 4 standard versions of the JH hash function:
//!
//! * `JH-224`
//! * `JH-256`
//! * `JH-384`
//! * `JH-512`
//!
//! # Examples
//!
//! Output size of JH-256 is fixed, so its functionality is usually
//! accessed via the `Digest` trait:
//!
//! ```
//! use hex_literal::hex;
//! use jh::{Digest, Jh256, digest::generic_array::typenum::U32};
//!
//! // create a JH-256 object
//! let mut hasher = Jh256::new();
//!
//! // write input message
//! hasher.update(b"hello");
//!
//! // read hash digest
//! let result = hasher.finalize();
//!
//! assert_eq!(result[..], hex!("
//! 94fd3f4c564957c6754265676bf8b244c707d3ffb294e18af1f2e4f9b8306089
//! ")[..]);
//! ```
//! Also see [RustCrypto/hashes][2] readme.
//!
//! [1]: https://www3.ntu.edu.sg/home/wuhj/research/jh
//! [2]: https://github.com/RustCrypto/hashes
#![no_std]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
)]
#![warn(missing_docs, rust_2018_idioms)]

#[doc(hidden)]
pub mod compressor;
mod consts;

pub use digest::Digest;
pub use digest::{self, Digest};

use crate::compressor::Compressor;
use core::fmt;
Expand All @@ -19,6 +62,9 @@ use digest::{

macro_rules! define_hasher {
($name:ident, $full_name:ident, $init:path, $OutputBytes:ident, $alg_name:expr) => {
#[doc = "Core "]
#[doc = $alg_name]
#[doc = " hasher state."]
#[derive(Clone)]
pub struct $name {
block_len: u64,
Expand Down

0 comments on commit ea0de56

Please sign in to comment.