hashes: Rename hash_type macro

Conceptually (and using traits) we split the hashes into "general"
hash types and more restricted hash types (`Hash`). Also we observe that
the `hash_type` macro defines all the inherent functions name
identically to the `GeneralHash` trait methods.

Rename the trait to describe better what it does.

Internal change only.
This commit is contained in:
Tobin C. Harding 2024-10-16 12:05:30 +11:00
parent 62617cf9ac
commit c11587d60d
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
9 changed files with 11 additions and 11 deletions

View File

@ -9,7 +9,7 @@
use crate::{ripemd160, sha256};
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
160,
false,
"Output of the Bitcoin HASH160 hash function. (RIPEMD160(SHA256))"

View File

@ -112,7 +112,7 @@ macro_rules! hash_trait_impls {
}
pub(crate) use hash_trait_impls;
/// Creates a type called `Hash` and implements standard interface for it.
/// Creates a type called `Hash` and implements the standard general hashing interface for it.
///
/// The created type has a single field and will have all standard derives as well as an
/// implementation of [`crate::Hash`].
@ -125,7 +125,7 @@ pub(crate) use hash_trait_impls;
///
/// The `from_engine` free-standing function is still required with this macro. See the doc of
/// [`hash_trait_impls`].
macro_rules! hash_type {
macro_rules! general_hash_type {
($bits:expr, $reverse:expr, $doc:literal) => {
$crate::internal_macros::hash_type_no_default!($bits, $reverse, $doc);
@ -157,7 +157,7 @@ macro_rules! hash_type {
}
};
}
pub(crate) use hash_type;
pub(crate) use general_hash_type;
macro_rules! hash_type_no_default {
($bits:expr, $reverse:expr, $doc:literal) => {

View File

@ -6,7 +6,7 @@ use core::cmp;
use crate::{incomplete_block_len, HashEngine as _};
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
160,
false,
"Output of the RIPEMD160 hash function."

View File

@ -6,7 +6,7 @@ use core::cmp;
use crate::{incomplete_block_len, HashEngine as _};
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
160,
false,
"Output of the SHA1 hash function."

View File

@ -14,7 +14,7 @@ use crate::{incomplete_block_len, sha256d, HashEngine as _};
#[cfg(doc)]
use crate::{sha256t, sha256t_tag};
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
256,
false,
"Output of the SHA256 hash function."

View File

@ -4,7 +4,7 @@
use crate::sha256;
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
256,
true,
"Output of the SHA256d hash function."

View File

@ -4,7 +4,7 @@
use crate::sha512;
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
384,
false,
"Output of the SHA384 hash function."

View File

@ -6,7 +6,7 @@ use core::cmp;
use crate::{incomplete_block_len, HashEngine as _};
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
512,
false,
"Output of the SHA512 hash function."

View File

@ -9,7 +9,7 @@
use crate::sha512;
crate::internal_macros::hash_type! {
crate::internal_macros::general_hash_type! {
256,
false,
"Output of the SHA512/256 hash function.\n\nSHA512/256 is a hash function that uses the sha512 algorithm but it truncates the output to 256 bits. It has different initial constants than sha512 so it produces an entirely different hash compared to sha512. More information at <https://eprint.iacr.org/2010/548.pdf>."