From ebf35d7f2913fd6285c024c08aa72e89a98c64a6 Mon Sep 17 00:00:00 2001 From: wakiyamap Date: Sat, 29 Jun 2024 22:04:35 +0900 Subject: [PATCH] update sha3(keccak) --- Cargo.lock | 36 +++++++++++++++++++++++------------- Cargo.toml | 2 +- src/lyra2re.rs | 4 ++-- src/lyra2rev2.rs | 5 +++-- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6909e2..df55cc4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,6 +53,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -103,9 +112,18 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.0" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "libc" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "lyra2" @@ -119,12 +137,6 @@ dependencies = [ "skein-hash", ] -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -133,14 +145,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "sha3" -version = "0.9.1" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", + "digest 0.10.7", "keccak", - "opaque-debug", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c097c21..7ca4751 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ keywords = ["lyra2", "Lyra2RE", "Lyra2REv2", "Lyra2REv3"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sha3 = "0.9.1" +sha3 = "0.10.8" blake-hash = "0.4.1" groestl = "0.10.1" byteorder = { version = "1.3.4", default-features = false } diff --git a/src/lyra2re.rs b/src/lyra2re.rs index 6470afa..d546140 100644 --- a/src/lyra2re.rs +++ b/src/lyra2re.rs @@ -4,7 +4,7 @@ use crate::lyra2; use digest::generic_array::typenum::U32; use blake_hash::Digest as BlakeDigest; -use groestl::Digest; +use sha3::Digest; /// Returns the calculation result of lyra2re. /// # Examples @@ -23,7 +23,7 @@ use groestl::Digest; pub fn sum(input: Vec) -> Vec { let result_blake = blake_hash::Blake256::digest(&input).to_vec(); - let result_keccak256_1 = sha3::Keccak256::digest(&result_blake).to_vec(); + let result_keccak256_1 = sha3::Keccak256::digest(result_blake).to_vec(); let result_keccak256_2 = result_keccak256_1.clone(); diff --git a/src/lyra2rev2.rs b/src/lyra2rev2.rs index f88dda6..712f761 100644 --- a/src/lyra2rev2.rs +++ b/src/lyra2rev2.rs @@ -5,7 +5,8 @@ use crate::bmw; use crate::cubehash; use crate::lyra2; use digest::generic_array::typenum::U32; -use blake_hash::Digest; +use blake_hash::Digest as BlakeDigest; +use sha3::Digest; /// Returns the calculation result of lyra2rev2. /// # Examples @@ -24,7 +25,7 @@ use blake_hash::Digest; pub fn sum(input: Vec) -> Vec { let result_blake = blake_hash::Blake256::digest(&input).to_vec(); - let result_keccak256 = sha3::Keccak256::digest(&result_blake); + let result_keccak256 = sha3::Keccak256::digest(result_blake); let result_cube = cubehash::sum(result_keccak256.to_vec());