aboutsummaryrefslogtreecommitdiff
path: root/rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2022-10-10 21:30:02 +0200
committerAndreas Grois <andi@grois.info>2022-10-10 21:37:15 +0200
commite4ad766315879e1ff05bb111229f073f8f0ed68e (patch)
tree4b043ff47c78b2c00c80c94ebda622c32c8b6d3d /rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs
PassFish: Initial Commit
Well, that's a lie. But nobody needs to see all the iterations I decided to sweep under the rug. That said, I think the repo is, while not clean, clean enough now, to not be embarrassed by uploading it to github.
Diffstat (limited to 'rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs')
-rw-r--r--rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs b/rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs
new file mode 100644
index 0000000..85fbc39
--- /dev/null
+++ b/rust/src/implementation/passwordmaker/helperthread/hashers/mod.rs
@@ -0,0 +1,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 {}