mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-23 03:59:22 +00:00
Replace tiny_keccak with sha3 in Monero
This commit is contained in:
parent
fd48bbd15e
commit
49749d96a0
3 changed files with 5 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -4608,9 +4608,9 @@ dependencies = [
|
|||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha3 0.10.5",
|
||||
"subtle",
|
||||
"thiserror",
|
||||
"tiny-keccak",
|
||||
"tokio",
|
||||
"zeroize",
|
||||
]
|
||||
|
|
|
@ -22,7 +22,7 @@ rand_distr = "0.4"
|
|||
zeroize = { version = "1.3", features = ["zeroize_derive"] }
|
||||
subtle = "2.4"
|
||||
|
||||
tiny-keccak = { version = "2", features = ["keccak"] }
|
||||
sha3 = "0.10"
|
||||
blake2 = { version = "0.10", optional = true }
|
||||
|
||||
curve25519-dalek = { version = "3", features = ["std"] }
|
||||
|
|
|
@ -17,7 +17,7 @@ use rand_core::{RngCore, CryptoRng};
|
|||
|
||||
use zeroize::{Zeroize, ZeroizeOnDrop};
|
||||
|
||||
use tiny_keccak::{Hasher, Keccak};
|
||||
use sha3::{Digest, Keccak256};
|
||||
|
||||
use curve25519_dalek::{
|
||||
constants::ED25519_BASEPOINT_TABLE,
|
||||
|
@ -109,12 +109,8 @@ pub fn random_scalar<R: RngCore + CryptoRng>(rng: &mut R) -> Scalar {
|
|||
Scalar::from_bytes_mod_order_wide(&r)
|
||||
}
|
||||
|
||||
pub fn hash(data: &[u8]) -> [u8; 32] {
|
||||
let mut keccak = Keccak::v256();
|
||||
keccak.update(data);
|
||||
let mut res = [0; 32];
|
||||
keccak.finalize(&mut res);
|
||||
res
|
||||
pub(crate) fn hash(data: &[u8]) -> [u8; 32] {
|
||||
Keccak256::digest(data).into()
|
||||
}
|
||||
|
||||
/// Hash the provided data to a scalar via keccak256(data) % l.
|
||||
|
|
Loading…
Reference in a new issue