use crate::sealed::Sealed;
#[cfg(doc)]
use crate::GitOid;
use digest::Digest;
use sha1::Sha1;
use sha1collisiondetection::Sha1CD as Sha1Cd;
use sha2::Sha256;
mod private {
pub trait Sealed {}
}
pub trait HashAlgorithm: Digest + Sealed {
const NAME: &'static str;
}
macro_rules! impl_hash_algorithm {
( $type:ty, $name:literal ) => {
impl Sealed for $type {}
impl HashAlgorithm for $type {
const NAME: &'static str = $name;
}
};
}
impl_hash_algorithm!(Sha1, "sha1");
impl_hash_algorithm!(Sha256, "sha256");
impl_hash_algorithm!(Sha1Cd, "sha1cd");