add blake3
This commit is contained in:
parent
d56ab2ff64
commit
80f0ce9d61
4 changed files with 59 additions and 1 deletions
47
Cargo.lock
generated
47
Cargo.lock
generated
|
@ -52,6 +52,18 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||
|
||||
[[package]]
|
||||
name = "ascon-core"
|
||||
version = "0.5.1"
|
||||
|
@ -93,6 +105,19 @@ dependencies = [
|
|||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blake3"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"arrayvec",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"constant_time_eq",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
|
@ -111,6 +136,15 @@ dependencies = [
|
|||
"hybrid-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.1"
|
||||
|
@ -172,6 +206,12 @@ dependencies = [
|
|||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.17"
|
||||
|
@ -370,6 +410,7 @@ dependencies = [
|
|||
"ascon-hash",
|
||||
"belt-hash",
|
||||
"blake2",
|
||||
"blake3",
|
||||
"clap",
|
||||
"colored",
|
||||
"fsb",
|
||||
|
@ -470,6 +511,12 @@ dependencies = [
|
|||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "skein"
|
||||
version = "0.1.1"
|
||||
|
|
|
@ -28,3 +28,4 @@ sm3 = "0.4.2"
|
|||
streebog = "0.10.2"
|
||||
tiger = "0.2.1"
|
||||
whirlpool = "0.10.4"
|
||||
blake3 = "1.8.2"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use ascon_hash::AsconHash256;
|
||||
use belt_hash::BeltHash;
|
||||
use blake2::{Blake2b512, Blake2s256};
|
||||
use blake3::Hasher as Blake3;
|
||||
use fsb::{Fsb160, Fsb224, Fsb256, Fsb384, Fsb512};
|
||||
use gost94::Gost94CryptoPro;
|
||||
use groestl::{Groestl224, Groestl256, Groestl384, Groestl512};
|
||||
|
@ -327,6 +328,13 @@ pub fn hash_belt(mut file: File) -> String {
|
|||
return format!("{:x}", hasher.finalize());
|
||||
}
|
||||
|
||||
pub fn hash_blake3(mut file: File) -> String {
|
||||
let mut hasher = Blake3::default();
|
||||
_ = io::copy(&mut file, &mut hasher);
|
||||
|
||||
return format!("{}", hasher.finalize().to_hex());
|
||||
}
|
||||
|
||||
pub fn hash_blake2b512(mut file: File) -> String {
|
||||
let mut hasher = Blake2b512::new();
|
||||
_ = io::copy(&mut file, &mut hasher);
|
||||
|
|
|
@ -9,9 +9,10 @@ use std::thread::{self, available_parallelism, JoinHandle};
|
|||
mod common;
|
||||
mod hashers;
|
||||
|
||||
const ALGORITHMS: [&'static str; 37] = [
|
||||
const ALGORITHMS: [&'static str; 38] = [
|
||||
"ascon",
|
||||
"belt",
|
||||
"blake3",
|
||||
"blake2b512",
|
||||
"blake2s256",
|
||||
"fsb160",
|
||||
|
@ -170,6 +171,7 @@ fn hash(info: ThreadInfo) -> Result<(), String> {
|
|||
"belt" => hashers::hash_belt(file),
|
||||
"blake2b512" => hashers::hash_blake2b512(file),
|
||||
"blake2s256" => hashers::hash_blake2s256(file),
|
||||
"blake3" => hashers::hash_blake3(file),
|
||||
"fsb160" => hashers::hash_fsb160(file),
|
||||
"fsb224" => hashers::hash_fsb224(file),
|
||||
"fsb256" => hashers::hash_fsb256(file),
|
||||
|
|
Loading…
Add table
Reference in a new issue