mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Correct a couple years of accumulated typos
This commit is contained in:
@@ -52,7 +52,7 @@ pub trait Ciphersuite:
|
||||
/// Group element type.
|
||||
type G: Group<Scalar = Self::F> + GroupOps + PrimeGroup + Zeroize + ConstantTimeEq;
|
||||
/// Hash algorithm used with this curve.
|
||||
// Requires BlockSizeUser so it can be used within Hkdf which requies that.
|
||||
// Requires BlockSizeUser so it can be used within Hkdf which requires that.
|
||||
type H: Send + Clone + BlockSizeUser + Digest + HashMarker + SecureDigest;
|
||||
|
||||
/// ID for this curve.
|
||||
|
||||
@@ -222,7 +222,7 @@ impl FieldElement {
|
||||
FieldElement(reduce(U512::from(value.mul_wide(&value))))
|
||||
}
|
||||
|
||||
/// Perform an exponentation.
|
||||
/// Perform an exponentiation.
|
||||
pub fn pow(&self, other: FieldElement) -> FieldElement {
|
||||
let mut table = [FieldElement::ONE; 16];
|
||||
table[1] = *self;
|
||||
|
||||
@@ -118,7 +118,7 @@ fn cipher<C: Ciphersuite>(context: &str, ecdh: &Zeroizing<C::G>) -> ChaCha20 {
|
||||
zeroize(challenge.as_mut());
|
||||
|
||||
// Since the key is single-use, it doesn't matter what we use for the IV
|
||||
// The isssue is key + IV reuse. If we never reuse the key, we can't have the opportunity to
|
||||
// The issue is key + IV reuse. If we never reuse the key, we can't have the opportunity to
|
||||
// reuse a nonce
|
||||
// Use a static IV in acknowledgement of this
|
||||
let mut iv = Cc20Iv::default();
|
||||
|
||||
@@ -20,7 +20,7 @@ pub fn scalar_normalize<F0: PrimeFieldBits + Zeroize, F1: PrimeFieldBits>(
|
||||
|
||||
let mut res1 = F0::ZERO;
|
||||
let mut res2 = F1::ZERO;
|
||||
// Uses the bits API to ensure a consistent endianess
|
||||
// Uses the bits API to ensure a consistent endianness
|
||||
let mut bits = scalar.to_le_bits();
|
||||
scalar.zeroize();
|
||||
// Convert it to big endian
|
||||
|
||||
@@ -28,7 +28,7 @@ mod tests;
|
||||
pub(crate) fn challenge<T: Transcript, F: PrimeField>(transcript: &mut T) -> F {
|
||||
// From here, there are three ways to get a scalar under the ff/group API
|
||||
// 1: Scalar::random(ChaCha20Rng::from_seed(self.transcript.rng_seed(b"challenge")))
|
||||
// 2: Grabbing a UInt library to perform reduction by the modulus, then determining endianess
|
||||
// 2: Grabbing a UInt library to perform reduction by the modulus, then determining endianness
|
||||
// and loading it in
|
||||
// 3: Iterating over each byte and manually doubling/adding. This is simplest
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ macro_rules! field {
|
||||
}
|
||||
|
||||
impl $FieldName {
|
||||
/// Perform an exponentation.
|
||||
/// Perform an exponentiation.
|
||||
pub fn pow(&self, other: $FieldName) -> $FieldName {
|
||||
let mut table = [Self(Residue::ONE); 16];
|
||||
table[1] = *self;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub trait Algorithm<C: Curve>: Send + Sync + Clone {
|
||||
/// Read an addendum from a reader.
|
||||
fn read_addendum<R: Read>(&self, reader: &mut R) -> io::Result<Self::Addendum>;
|
||||
|
||||
/// Proccess the addendum for the specified participant. Guaranteed to be called in order.
|
||||
/// Process the addendum for the specified participant. Guaranteed to be called in order.
|
||||
fn process_addendum(
|
||||
&mut self,
|
||||
params: &ThresholdView<C>,
|
||||
|
||||
@@ -43,7 +43,7 @@ pub struct Vectors {
|
||||
}
|
||||
|
||||
// Vectors are expected to be formatted per the IETF proof of concept
|
||||
// The included vectors are direcly from
|
||||
// The included vectors are directly from
|
||||
// https://github.com/cfrg/draft-irtf-cfrg-frost/tree/draft-irtf-cfrg-frost-14/poc
|
||||
#[cfg(test)]
|
||||
impl From<serde_json::Value> for Vectors {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "multiexp"
|
||||
version = "0.4.0"
|
||||
description = "Multiexponentation algorithms for ff/group"
|
||||
description = "Multiexponentiation algorithms for ff/group"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/multiexp"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
A multiexp implementation for ff/group implementing Straus and Pippenger. A
|
||||
batch verification API is also available via the "batch" feature, which enables
|
||||
secure multiexponentation batch verification given a series of values which
|
||||
secure multiexponentiation batch verification given a series of values which
|
||||
should sum to the identity, identifying which doesn't via binary search if they
|
||||
don't.
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ fn algorithm(len: usize) -> Algorithm {
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs a multiexponentation, automatically selecting the optimal algorithm based on the
|
||||
/// Performs a multiexponentiation, automatically selecting the optimal algorithm based on the
|
||||
/// amount of pairs.
|
||||
pub fn multiexp<G: Group>(pairs: &[(G::Scalar, G)]) -> G
|
||||
where
|
||||
@@ -188,7 +188,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs a multiexponentation in variable time, automatically selecting the optimal algorithm
|
||||
/// Performs a multiexponentiation in variable time, automatically selecting the optimal algorithm
|
||||
/// based on the amount of pairs.
|
||||
pub fn multiexp_vartime<G: Group>(pairs: &[(G::Scalar, G)]) -> G
|
||||
where
|
||||
|
||||
@@ -5,7 +5,7 @@ use group::Group;
|
||||
|
||||
use crate::prep_bits;
|
||||
|
||||
// Pippenger's algorithm for multiexponentation, as published in the SIAM Journal on Computing
|
||||
// Pippenger's algorithm for multiexponentiation, as published in the SIAM Journal on Computing
|
||||
// DOI: 10.1137/0209022
|
||||
pub(crate) fn pippenger<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> G
|
||||
where
|
||||
|
||||
@@ -22,7 +22,7 @@ fn prep_tables<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> Vec<Vec<G>> {
|
||||
tables
|
||||
}
|
||||
|
||||
// Straus's algorithm for multiexponentation, as published in The American Mathematical Monthly
|
||||
// Straus's algorithm for multiexponentiation, as published in The American Mathematical Monthly
|
||||
// DOI: 10.2307/2310929
|
||||
pub(crate) fn straus<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> G
|
||||
where
|
||||
|
||||
@@ -83,7 +83,7 @@ impl<C: Ciphersuite> SchnorrSignature<C> {
|
||||
}
|
||||
|
||||
/// Return the series of pairs whose products sum to zero for a valid signature.
|
||||
/// This is inteded to be used with a multiexp.
|
||||
/// This is intended to be used with a multiexp.
|
||||
pub fn batch_statements(&self, public_key: C::G, challenge: C::F) -> [(C::F, C::G); 3] {
|
||||
// s = r + ca
|
||||
// sG == R + cA
|
||||
|
||||
Reference in New Issue
Block a user