bign256 0.13.1

Pure Rust implementation of the Bign P-256 (a.k.a. bign-curve256v1) elliptic curve as defined in STB 34.101.45-2013, with general purpose curve arithmetic
Documentation
//! Scalar arithmetic tests.

#![cfg(feature = "arithmetic")]

use bign256::{Scalar, U256};
use elliptic_curve::ops::{Invert, Reduce};
use proptest::prelude::*;

prop_compose! {
    fn scalar()(bytes in any::<[u8; 32]>()) -> Scalar {
        <Scalar as Reduce<U256>>::reduce_bytes(&bytes.into())
    }
}

proptest! {
    #[test]
    fn invert_and_invert_vartime_are_equivalent(w in scalar()) {
        let inv: Option<Scalar> = w.invert().into();
        let inv_vartime: Option<Scalar> = w.invert_vartime().into();
        prop_assert_eq!(inv, inv_vartime);
    }
}