Skip to content

Commit

Permalink
cryptonight naming fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
detherminal committed Apr 6, 2024
1 parent e98ed16 commit 52a3b5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/crypt/cryptonight/slow_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
7 changes: 4 additions & 3 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 52a3b5a

Please sign in to comment.