Commit Graph

67 Commits

Author SHA1 Message Date
Mamy André-Ratsimbazafy 8d160189d1
Fix extended prec multiplication carry. Passing modulo tests against medium BigInt (192~256 bits) 2020-02-10 22:19:47 +01:00
Mamy André-Ratsimbazafy 73b71a184c
Fix off-by-one copy, pass small bigints modulo tests 2020-02-10 19:57:35 +01:00
Mamy André-Ratsimbazafy b689223cf5
Refactoring, optimize code-size: use type-erased views to avoid monomorphization of compute kernels 2020-02-10 18:16:34 +01:00
Mamy André-Ratsimbazafy ade919b003
Fix carry and modulus offset in bigint 2020-02-10 02:58:37 +01:00
Mamy André-Ratsimbazafy 3033ae30f8
Fix uint32 extended precision multiplication 2020-02-10 02:12:44 +01:00
Mamy André-Ratsimbazafy 30f8756dfc
Temp switch to uint32 words for testing modulo. Remove tests that depend on word size 2020-02-10 00:16:46 +01:00
Mamy André-Ratsimbazafy 166a1075b1
add bigint display in GMP test 2020-02-09 23:26:39 +01:00
Mamy André-Ratsimbazafy 08ed81af34
Don't forget to exit when dumpingraw integer 2020-02-09 23:05:23 +01:00
Mamy André-Ratsimbazafy a389e5c38c
in-place add/sub fix + Add note that native x86 division is flawed:
SIGFPE on quotient that don't fit in a word size
2020-02-09 23:00:21 +01:00
Mamy André-Ratsimbazafy 216ed9bdc1
Property-based testing framework vs GMP 2020-02-09 22:01:01 +01:00
Mamy André-Ratsimbazafy f2c79ece26
Remove the limitation that the number of bits in constructed has to be greater than the source integer bitsize 2020-02-09 21:35:23 +01:00
Mamy André-Ratsimbazafy 66c0b5805e
Add modular reduce / bigint mod from 2 arbitrarily size bigint 2020-02-09 18:17:32 +01:00
Mamy André-Ratsimbazafy 514715dff0
Allow muxing / cmov on bools 2020-02-09 17:49:38 +01:00
Mamy André-Ratsimbazafy 153e898263
word_types -> primitives + delete the "config" file / debug template 2020-02-09 16:22:55 +01:00
Mamy André-Ratsimbazafy 57ee2cb6bd
Fix inline assembly comments breaking build 2020-02-09 15:53:21 +01:00
Mamy André-Ratsimbazafy b9a37825a3
COnsistent IO API between fromRawUint and fromHex and add fromUint 2020-02-09 15:38:30 +01:00
Mamy André-Ratsimbazafy 1d92ab1f48
Remove the limb accessor templates, introduce config file for debug template 2020-02-09 13:02:09 +01:00
Mamy André-Ratsimbazafy ff8b22e1d1
Use file-wide "no exceptions" enforcement 2020-02-09 01:03:06 +01:00
Mamy André-Ratsimbazafy 9db77ad0eb
Prepare for testing finite fields, comment cleanups 2020-02-09 00:52:24 +01:00
Mamy André-Ratsimbazafy edd728610c
Add addition limbs carry test 2020-02-08 19:09:20 +01:00
Mamy André-Ratsimbazafy 2c750cbc5b
Add bigint isZero, and equality and initial tests 2020-02-08 18:50:01 +01:00
Mamy André-Ratsimbazafy 3034c07525
fromHex supports space and underscores 2020-02-08 18:22:19 +01:00
Mamy André-Ratsimbazafy 706678d2ee
Compiler enforced no exceptions 2020-02-08 18:21:47 +01:00
Mamy André-Ratsimbazafy 8da9e20ebb
Cosmetic changes: dumpHex with 0x prefix, montgomery magic part of curve param 2020-02-08 17:03:30 +01:00
Mamy André-Ratsimbazafy 18625cc5ac
Allow compilation of FInite Field and Montgomery domain, workaround showstopper bug: https://github.com/nim-lang/Nim/issues/11142 and #5 2020-02-08 15:33:05 +01:00
Mamy André-Ratsimbazafy bd2b10817e
Add curve configuration + BN254 config (zkSnarks, ZCash, Ethereum 1 precompile) 2020-02-08 14:55:49 +01:00
Mamy André-Ratsimbazafy f18a958d5e
Support 1.0+ int128 (can't use magic for bitnot) 2020-02-08 13:28:43 +01:00
Mamy André-Ratsimbazafy 8229bf384b
Remove specialization for static big int. They will be stored in the binary bss section and passed as ptr + length to save on codesize anyway. 2020-02-08 11:51:17 +01:00
Mamy André-Ratsimbazafy 5dc97927c5
Switch to personal project -> update copyright 2020-02-08 11:42:35 +01:00
Mamy André-Ratsimbazafy c4b3d49e69
Allow constant time booleans init from constant time uints 2019-04-29 23:17:56 +02:00
Mamy André-Ratsimbazafy cadd81b978
Add hex conversion 2019-04-28 17:42:30 +02:00
Mamy André-Ratsimbazafy 007c5e3071
Fix booleans initialization 2019-04-28 14:12:46 +02:00
Mamy André-Ratsimbazafy 08e12df4ed
internal proc renaming 2019-04-28 14:05:13 +02:00
Bruno Škvorc 3e9a03fc02
Update README.md 2019-01-02 15:09:55 +01:00
mratsim 411e40b843 use CtTrueCtFalse instead of True/False for alias of the constant time bool 2018-12-03 21:10:36 +01:00
Mamy Ratsimbazafy 6eaa24e91b
Merge pull request #3 from status-im/bigInt-dump
Big int dump
2018-12-03 21:03:21 +01:00
mratsim 059439b2c3 fix little-endian parsing 2018-12-03 21:01:29 +01:00
mratsim 2856378427 [IO] dumping 2^63 works 2018-12-03 19:56:14 +01:00
mratsim df72a0896b initial implementation of bigInt dump 2018-12-02 22:18:17 +01:00
mratsim 43ac4972a0 Add constant-time raw bytes/integers parsing 2018-12-02 20:57:32 +01:00
mratsim b496f57c68 Replace HighLimb by MaxWord as well 2018-12-02 19:32:52 +01:00
mratsim 9b1dc4ca30 Replace Limb terminology by Word 2018-12-02 19:30:17 +01:00
mratsim 27e2d2d2bc Implement to Montgomery domain conversion 2018-12-02 19:28:42 +01:00
mratsim 22d8bc218d Implement scale accumulate 2018-12-02 19:08:21 +01:00
mratsim c226987ab0 Add extended precision multiplication 2018-12-02 18:14:32 +01:00
mratsim 057ce0cbf9 Implement fused multiply add modular multiplication for single limb "bigint". TODO fallback from assembly. 2018-12-02 16:32:38 +01:00
mratsim 408bc9b6f3 Introduce convention, all for loop should have an explicit static range 2018-12-02 13:01:54 +01:00
mratsim 71e5b576c4 Fix mod inverse 2^k nb of iterations 2018-12-02 12:59:46 +01:00
mratsim 67d038c650 Implement modular inverse mod 2^k for Montgomery multiplication 2018-12-02 03:45:13 +01:00
mratsim befbf30319 Add modular addition over Fp 2018-12-02 00:35:55 +01:00