mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Implement hash_to_point in Rust
Closes https://github.com/serai-dex/serai/issues/32.
This commit is contained in:
@@ -12,9 +12,9 @@ use frost::curve::Ed25519;
|
||||
|
||||
use crate::{
|
||||
Commitment,
|
||||
random_scalar, generate_key_image,
|
||||
random_scalar,
|
||||
wallet::Decoys,
|
||||
ringct::clsag::{ClsagInput, Clsag}
|
||||
ringct::{generate_key_image, clsag::{ClsagInput, Clsag}}
|
||||
};
|
||||
#[cfg(feature = "multisig")]
|
||||
use crate::{frost::MultisigError, ringct::clsag::{ClsagDetails, ClsagMultisig}};
|
||||
@@ -48,7 +48,7 @@ fn clsag() {
|
||||
ring.push([&dest * &ED25519_BASEPOINT_TABLE, Commitment::new(mask, amount).calculate()]);
|
||||
}
|
||||
|
||||
let image = generate_key_image(&secrets[0]);
|
||||
let image = generate_key_image(secrets[0]);
|
||||
let (clsag, pseudo_out) = Clsag::sign(
|
||||
&mut OsRng,
|
||||
&vec![(
|
||||
|
||||
13
coins/monero/src/tests/hash_to_point.rs
Normal file
13
coins/monero/src/tests/hash_to_point.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
use curve25519_dalek::constants::ED25519_BASEPOINT_TABLE;
|
||||
|
||||
use crate::{random_scalar, ringct::hash_to_point::{hash_to_point, rust_hash_to_point}};
|
||||
|
||||
#[test]
|
||||
fn test_hash_to_point() {
|
||||
for _ in 0 .. 200 {
|
||||
let point = &random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE;
|
||||
assert_eq!(rust_hash_to_point(point), hash_to_point(point));
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
mod hash_to_point;
|
||||
mod clsag;
|
||||
mod address;
|
||||
|
||||
Reference in New Issue
Block a user