aboutsummaryrefslogtreecommitdiff
path: root/rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs
blob: 85fbc3927f46f34593de22d8276d464731195ea5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
mod qt_hash;
use passwordmaker_rs::{Hasher, HasherList};
use ripemd::Digest;


pub(super) use qt_hash::{QtMd4, QtMd5, QtSha1, QtSha256};
pub(super) struct Ripemd160;

impl Hasher for Ripemd160{
    type Output = [u8;20];

    fn hash(input : &[u8]) -> Self::Output {
        let hash = ripemd::Ripemd160::digest(input);
        hash.into()
    }
}

pub(super) struct PassFishHashers;
impl HasherList for PassFishHashers {
    type MD4 = QtMd4;
    type MD5 = QtMd5;
    type SHA1 = QtSha1;
    type SHA256 = QtSha256;
    type RIPEMD160 = Ripemd160;
}

impl passwordmaker_rs::Md4 for QtMd4 {}
impl passwordmaker_rs::Md5 for QtMd5 {}
impl passwordmaker_rs::Sha1 for QtSha1 {}
impl passwordmaker_rs::Sha256 for QtSha256 {}
impl passwordmaker_rs::Ripemd160  for Ripemd160 {}