mirror of
https://github.com/logos-storage/constantine.git
synced 2026-01-02 13:13:07 +00:00
* fix the new div2n1n_vartime on 32-bit - regression from #286 * remove unnecessary defensive programming * reactivate 32-bit CI to check on #244 * 32-bit: centralize OS, ISA and env variable config * enable assemble on x86 32-bit
23 lines
611 B
Nim
23 lines
611 B
Nim
# From issue #241
|
|
|
|
import
|
|
../../constantine/math/[
|
|
arithmetic,
|
|
io/io_bigints],
|
|
../../constantine/math_arbitrary_precision/arithmetic/limbs_divmod_vartime,
|
|
../../constantine/platforms/abstractions
|
|
|
|
let a = BigInt[64].fromUint(0xa0e5cb56a1c08396'u64)
|
|
let M = BigInt[64].fromUint(0xae57180eceb0206f'u64)
|
|
|
|
var r, r2: BigInt[64]
|
|
|
|
r.reduce(a, M)
|
|
doAssert r2.limbs.reduce_vartime(a.limbs, M.limbs)
|
|
|
|
let rBase = cast[BaseType](0xa0e5cb56a1c08396'u64) mod cast[BaseType](0xae57180eceb0206f'u64)
|
|
# echo r.toHex()
|
|
|
|
doAssert rBase == a.limbs[0].BaseType
|
|
doAssert bool(a == r)
|
|
echo "SUCCESS: t_bigints_mod.nim" |