Skip to content

Commit f001b5d

Browse files
authored
primefield: use modular sqrt from crypto-bigint (#1676)
Switches to the implementation added in RustCrypto/crypto-bigint#1139
1 parent 014aa97 commit f001b5d

File tree

4 files changed

+4
-233
lines changed

4 files changed

+4
-233
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ ed448-goldilocks = { path = "ed448-goldilocks" }
2626
hash2curve = { path = "hash2curve" }
2727
primefield = { path = "primefield" }
2828
primeorder = { path = "primeorder" }
29+
30+
crypto-bigint = { git = "https://github.com/RustCrypto/crypto-bigint" }

primefield/src/monty.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Field elements which use an internal Montgomery form representation, implemented using
22
//! `crypto-bigint`'s [`MontyForm`].
33
4-
mod sqrt;
5-
64
use crate::ByteOrder;
75
use bigint::{
86
ArrayEncoding, ByteArray, Invert, Limb, Reduce, Uint, Word, ctutils,
@@ -444,7 +442,7 @@ where
444442
}
445443

446444
fn sqrt(&self) -> CtOption<Self> {
447-
self.sqrt()
445+
self.inner.sqrt().map(|inner| Self { inner }).into()
448446
}
449447

450448
fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self) {

primefield/src/monty/sqrt.rs

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)