From 8da0743361e8e9cc9611889528b6666c403cea57 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 29 Sep 2022 08:08:49 -0400 Subject: [PATCH] Use sha3 in monero-generators --- Cargo.lock | 2 +- coins/monero/generators/Cargo.toml | 2 +- coins/monero/generators/src/lib.rs | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17584f8f..4990c5d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4579,8 +4579,8 @@ dependencies = [ "dalek-ff-group", "group", "lazy_static", + "sha3 0.10.5", "subtle", - "tiny-keccak", ] [[package]] diff --git a/coins/monero/generators/Cargo.toml b/coins/monero/generators/Cargo.toml index 800e9f35..e005f2ab 100644 --- a/coins/monero/generators/Cargo.toml +++ b/coins/monero/generators/Cargo.toml @@ -15,7 +15,7 @@ lazy_static = "1" subtle = "2.4" -tiny-keccak = { version = "2", features = ["keccak"] } +sha3 = "0.10" curve25519-dalek = { version = "3", features = ["std"] } diff --git a/coins/monero/generators/src/lib.rs b/coins/monero/generators/src/lib.rs index bcf9ccfa..20a2740a 100644 --- a/coins/monero/generators/src/lib.rs +++ b/coins/monero/generators/src/lib.rs @@ -4,7 +4,7 @@ use lazy_static::lazy_static; -use tiny_keccak::{Hasher, Keccak}; +use sha3::{Digest, Keccak256}; use curve25519_dalek::{ constants::ED25519_BASEPOINT_POINT, @@ -21,11 +21,7 @@ mod hash_to_point; pub use hash_to_point::hash_to_point; fn hash(data: &[u8]) -> [u8; 32] { - let mut keccak = Keccak::v256(); - keccak.update(data); - let mut res = [0; 32]; - keccak.finalize(&mut res); - res + Keccak256::digest(data).into() } lazy_static! {