diff --git a/Cargo.lock b/Cargo.lock index 7f70ede827..7a23002241 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7067,6 +7067,7 @@ dependencies = [ "primitive-types 0.12.2", "revm-precompile", "revm-primitives", + "ripemd", "rlp", "serde 1.0.204", "serde_bytes", diff --git a/Cargo.toml b/Cargo.toml index ec44dbbc9e..75e661c5af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -311,7 +311,7 @@ uuid = { version = "1.10.0", features = ["v4", "fast-rng"] } protobuf = { version = "2.28", features = ["with-bytes"] } redb = { version = "2.1.1" } rust-rocksdb = { version = "0.27.0", features = ["lz4", "jemalloc"] } - +ripemd = { version = "0.1.3" } # Note: the BEGIN and END comments below are required for external tooling. Do not remove. # BEGIN MOVE DEPENDENCIES diff --git a/frameworks/moveos-stdlib/Cargo.toml b/frameworks/moveos-stdlib/Cargo.toml index 7cc4d17b7c..0768d2548d 100644 --- a/frameworks/moveos-stdlib/Cargo.toml +++ b/frameworks/moveos-stdlib/Cargo.toml @@ -37,6 +37,7 @@ bech32 = { workspace = true } bs58 = { workspace = true, features = ["check"] } revm-precompile = { workspace = true } revm-primitives = { workspace = true } +ripemd = { workspace = true } move-binary-format = { workspace = true } move-bytecode-utils = { workspace = true } diff --git a/frameworks/moveos-stdlib/src/natives/moveos_stdlib/hash.rs b/frameworks/moveos-stdlib/src/natives/moveos_stdlib/hash.rs index 23dcafaf3c..8243cfc862 100644 --- a/frameworks/moveos-stdlib/src/natives/moveos_stdlib/hash.rs +++ b/frameworks/moveos-stdlib/src/natives/moveos_stdlib/hash.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use crate::natives::helpers::{make_module_natives, make_native}; -use fastcrypto::hash::{Blake2b256, HashFunction, Keccak256, Ripemd160}; +use fastcrypto::hash::{Blake2b256, HashFunction, HashFunctionWrapper, Keccak256}; +use ripemd::Ripemd160; use move_binary_format::errors::PartialVMResult; use move_core_types::gas_algebra::{InternalGas, InternalGasPerByte, NumBytes}; use move_vm_runtime::native_functions::{NativeContext, NativeFunction}; @@ -15,6 +16,8 @@ use move_vm_types::{ use smallvec::smallvec; use std::collections::VecDeque; +type Ripemd160Hash = HashFunctionWrapper; + fn hash, const DIGEST_SIZE: usize>( gas_params: &FromBytesGasParameters, _: &mut NativeContext, @@ -82,7 +85,7 @@ pub fn native_ripemd160( ty_args: Vec, args: VecDeque, ) -> PartialVMResult { - hash::(gas_params, context, ty_args, args) + hash::(gas_params, context, ty_args, args) } #[derive(Debug, Clone)]