Skip to content

Commit

Permalink
crypto-bigint: add init proptests for equivalence with num-bigint
Browse files Browse the repository at this point in the history
Adds an initial set of property-based tests to check equivalence between
`crypto_bigint::U256` and `num_bigint::BigUint`.
  • Loading branch information
tarcieri committed Jul 29, 2021
1 parent 615762c commit 864d091
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
**/Cargo.lock
**/*.proptest-regressions
256 changes: 256 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crypto-bigint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ zeroize = { version = "1", optional = true, default-features = false }

[dev-dependencies]
hex-literal = "0.3"
num-bigint = "0.4"
proptest = "1"

[features]
default = ["rand"]
Expand Down
2 changes: 1 addition & 1 deletion crypto-bigint/src/uint/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl<const LIMBS: usize> UInt<LIMBS> {

/// Perform wrapping multiplication, discarding overflow.
pub const fn wrapping_mul(&self, rhs: &Self) -> Self {
self.mul_wide(rhs).0
self.mul_wide(rhs).1
}

/// Perform checked multiplication, returning a [`CtOption`] which `is_some`
Expand Down
Loading

0 comments on commit 864d091

Please sign in to comment.