From 52a3b5ad4aec79e5a4fbc00fac1d14f5537903a1 Mon Sep 17 00:00:00 2001 From: dethe <76167420+detherminal@users.noreply.github.com> Date: Sat, 6 Apr 2024 03:05:42 +0300 Subject: [PATCH] cryptonight naming fixes --- src/crypt/cryptonight/slow_hash.rs | 6 +++--- tests/integration_test.rs | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/crypt/cryptonight/slow_hash.rs b/src/crypt/cryptonight/slow_hash.rs index 399cba3..3aa6400 100644 --- a/src/crypt/cryptonight/slow_hash.rs +++ b/src/crypt/cryptonight/slow_hash.rs @@ -18,13 +18,13 @@ const SCRATCHPAD_SIZE: usize = 2 * 1024 * 1024; // 2 MiB /// /// Example: /// ``` -/// use libmonero::crypt::cryptonight::cn_slow_hash_original; +/// use libmonero::crypt::cryptonight::cn_slow_hash_v0; /// /// let input: &str = "This is a test"; -/// let output: String = cn_slow_hash_original(input.as_bytes()); +/// let output: String = cn_slow_hash_v0(input.as_bytes()); /// assert_eq!(output, "a084f01d1437a09c6985401b60d43554ae105802c5f5d8a9b3253649c0be6605".to_string()); /// ``` -pub fn cn_slow_hash_original(input: &[u8]) -> String { +pub fn cn_slow_hash_v0(input: &[u8]) -> String { // CryptoNight Step 1: Initialization Of Scratchpad // First, the input is hashed using Keccak [KECCAK] with parameters b = diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 6c60a5e..fe544f1 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -1,7 +1,7 @@ #[cfg(test)] mod tests { use libmonero::keys::{derive_address, derive_hex_seed, derive_priv_keys, derive_pub_key, generate_seed}; - use libmonero::crypt::cryptonight::cn_slow_hash_original; + use libmonero::crypt::cryptonight::cn_slow_hash_v0; #[test] fn seed_generation() { @@ -30,9 +30,10 @@ mod tests { #[cfg(test)] #[allow(warnings)] - fn hashing_cn_slow_original() { + fn hashing_cn_slow_hash_v0() { + let input = b"This is a test"; - let output = cn_slow_hash_original(input); + let output = cn_slow_hash_v0(input); assert_eq!( output, "a084f01d1437a09c6985401b60d43554ae105802c5f5d8a9b3253649c0be6605".to_string()