Move the Monero create to coins/

Includes misc bug fixes
This commit is contained in:
Luke Parker 2022-04-27 00:09:05 -04:00
parent 79f39c4433
commit df4be9ca0c
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6
19 changed files with 13 additions and 3 deletions

4
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "sign/monero/c/monero"]
path = sign/monero/c/monero
[submodule "coins/monero/c/monero"]
path = coins/monero/c/monero
url = https://github.com/monero-project/monero

View file

@ -3,5 +3,5 @@
members = [
"sign/frost",
"sign/dalek-ff-group",
"sign/monero",
"coins/monero",
]

View file

@ -8,6 +8,7 @@ edition = "2021"
[dependencies]
rand_core = "0.6"
digest = "0.10"
subtle = "2.4"

View file

@ -5,6 +5,7 @@ use core::{
};
use rand_core::RngCore;
use digest::{consts::U64, Digest};
use subtle::{Choice, CtOption, ConstantTimeEq, ConditionallySelectable};
@ -146,6 +147,14 @@ impl PrimeField for Scalar {
fn root_of_unity() -> Self { unimplemented!() }
}
impl Scalar {
pub fn from_hash<D: Digest<OutputSize = U64>>(hash: D) -> Scalar {
let mut output = [0u8; 64];
output.copy_from_slice(&hash.finalize());
Scalar(DScalar::from_bytes_mod_order_wide(&output))
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct EdwardsPoint(pub DPoint);
pub const ED25519_BASEPOINT_POINT: EdwardsPoint = EdwardsPoint(constants::ED25519_BASEPOINT_POINT);