Move functions around

This commit is contained in:
aniampio
2024-07-24 22:42:44 +01:00
parent 9989c226ae
commit 10b63f8667
3 changed files with 6 additions and 11 deletions
@@ -11,11 +11,10 @@ use itertools::Itertools;
use crate::common_types::{PartialSignature, Signature, SignatureShare, SignerIndex};
use crate::error::{CompactEcashError, Result};
use crate::scheme::expiration_date_signatures::scalar_date;
use crate::scheme::expiration_date_signatures::scalar_type;
use crate::scheme::keygen::{SecretKeyUser, VerificationKeyAuth};
use crate::scheme::withdrawal::RequestInfo;
use crate::scheme::{PartialWallet, Wallet, WalletSignatures};
use crate::utils::{check_bilinear_pairing, perform_lagrangian_interpolation_at_origin};
use crate::utils::{check_bilinear_pairing, perform_lagrangian_interpolation_at_origin, scalar_type};
use crate::{ecash_group_parameters, Attribute};
pub(crate) trait Aggregatable: Sized {
@@ -411,15 +411,6 @@ pub fn scalar_date(scalar: &Scalar) -> u64 {
u64::from_le_bytes([b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]])
}
pub fn type_scalar(t_type: u64) -> Scalar {
Scalar::from(t_type)
}
pub fn scalar_type(scalar: &Scalar) -> u64 {
let b = scalar.to_bytes();
u64::from_le_bytes([b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]])
}
#[cfg(test)]
mod tests {
use super::*;
@@ -402,3 +402,8 @@ mod tests {
assert_ne!(hash_to_scalar(msg1), hash_to_scalar(msg2));
}
}
pub fn scalar_type(scalar: &Scalar) -> u64 {
let b = scalar.to_bytes();
u64::from_le_bytes([b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]])
}