Avoid explicit curve25519_dalek dependency in demo/

This commit is contained in:
Michael Vines 2021-10-01 08:18:10 -07:00
parent 1ef3a621a8
commit 23d3b540a1
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,8 @@
use {
curve25519_dalek::{ristretto::RistrettoPoint, scalar::Scalar, traits::Identity},
curve25519_dalek::{
constants::RISTRETTO_BASEPOINT_POINT as G, ristretto::RistrettoPoint, scalar::Scalar,
traits::Identity,
},
serde::{Deserialize, Serialize},
std::collections::HashMap,
};
@ -46,6 +49,12 @@ pub fn decode_u32_precomputation(generator: RistrettoPoint) -> HashMap<[u8; 32],
hashmap
}
/// Pre-compute HashMap needed for decryption. The HashMap is independent of (works for) any key.
#[allow(non_snake_case)]
pub fn decode_u32_precomputation_for_G() -> HashMap<[u8; 32], u32> {
decode_u32_precomputation(G)
}
/// Solves the discrete log instance using a 18/14 bit offline/online split
impl DiscreteLogInstance {
/// Solves the discrete log problem under the assumption that the solution
@ -100,7 +109,7 @@ impl Iterator for RistrettoIterator {
#[cfg(test)]
mod tests {
use {super::*, curve25519_dalek::constants::RISTRETTO_BASEPOINT_POINT as G};
use super::*;
/// Discrete log test for 16/16 split
///

View File

@ -17,5 +17,3 @@ mod instruction;
pub mod zk_token_elgamal;
pub mod zk_token_proof_instruction;
pub mod zk_token_proof_program;
pub use curve25519_dalek;