Commit Graph

73 Commits

Author SHA1 Message Date
Daira Hopwood 56945c09e0 Import sys explicitly rather than relying on sage to do it.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 13:28:25 +00:00
Daira Hopwood bf740d64b8 Add some nice assertions and tests to make it clearer what is going on.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 13:17:18 +00:00
Daira Hopwood 7bf9015957 Assert that there are no collisions in invtab.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 12:00:50 +00:00
Daira Hopwood 79738d2cb7 Improve the perfect hash function.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 10:43:17 +00:00
Daira Hopwood bda5810e46 Python 2 compatibility.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-30 10:42:55 +00:00
Daira Hopwood a8b6b48b91 Include the cost of checking the result in the squaring cost.
(The algorithm will return a nonsense result for non-squares if we don't do this check.)

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:47:58 +00:00
Daira Hopwood 25dd9f0ed9 squareroottab.sage: remove unused instance variables.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:45:12 +00:00
Daira Hopwood 223b60825c Save one squaring.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:38:58 +00:00
Daira Hopwood d45dd14238 Make squareroot.sage more similar to squareroottab.sage to facilitate comparison.
(This is actually a slight pessimisation, but we're not going to use the non-table-based variant.)

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:35:36 +00:00
Daira Hopwood e7f9d2cef6 squareroot.sage: turn off VERBOSE and EXPENSIVE.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:04:14 +00:00
Daira Hopwood b26d051c59 Slightly optimize addition chain for Fq.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 20:03:25 +00:00
Daira Hopwood 5bfaa90bf7 squareroottab.sage: inlining and shift microoptimizations.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 19:29:32 +00:00
Daira Hopwood 49878117db squareroottab.sage: inline eval, and remove an unused part of gtab[3].
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 19:03:43 +00:00
Daira Hopwood debab754cb squareroottab.sage: remove redundant code.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 18:45:04 +00:00
Daira Hopwood 4f47706877 Add table-based variant of square root.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 18:43:07 +00:00
Daira Hopwood fbd6f3b1bb squareroot.sage: improve debugging.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-29 18:42:33 +00:00
Daira Hopwood 6d9e412d8d squareroot.sage: do expensive assertions only if DEBUG is set.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-28 15:34:45 +00:00
Daira Hopwood 1d2c5d0826 squareroot.sage: optimize precomputation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-28 15:33:54 +00:00
Daira Hopwood 77524ce1a6 Prototype implementation of square roots on the Pasta fields (addition chains and Sarkar's algorithm).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-28 14:37:56 +00:00
Daira Hopwood 15a23b3b3b README: cosmetics.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-27 09:35:53 +00:00
Daira Hopwood 8f82a22d2c Remove requirement for sortedcontainers.
(This is less efficient, but it doesn't matter in practice, and people were having trouble
installing it in the same Python as used by sage.)

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-27 09:35:20 +00:00
Daira Hopwood 62e25b428a README: update for checksumsets etc.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-23 01:24:03 +00:00
Daira Hopwood e3c1e1cd53 checksumsets.py: fix an off-by-one error in the final frames of the animation (not the actual check).
Also update the animations for the Pasta curves.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-23 01:09:28 +00:00
Daira Hopwood d74fbbcd01 Python 3 portability.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-23 01:09:28 +00:00
Daira Hopwood cb6ef790f9 Update parameters for Pallas/Vesta.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-23 01:09:28 +00:00
Daira Hopwood 1cd1766100 Pallas/Vesta README.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-23 01:09:28 +00:00
Daira Hopwood a35294b64f Updates for Pallas/Vesta.
Use `sage amicable.sage --sequential --requireisos --sortpq --ignoretwist --nearpowerof2 255 32` to generate the Pallas/Vesta cycle.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-19 19:54:53 +00:00
Daira Hopwood 491beffc2c injectivitylemma.py: output information that I used in a slide in my ZK Study Club presentation.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-19 19:52:22 +00:00
Daira Hopwood a7071be29a Delete injectivitylemma6.py (using both nontrivial roots of unity cannot work because roots of unity sum to 0).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-11-19 19:50:02 +00:00
Daira Hopwood 9e56d94ddd amicable.py: fix low Hamming weight strategy.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-27 21:18:47 +01:00
Daira Hopwood 4609be5090 verify.sage: make executable.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 21:43:46 +01:00
Daira Hopwood 87335537b3 amicable.sage: various updates
* support --isogenies and --ignoretwist options
* more comprehensive usage string
* if at least 6 threads are available, don't use 2 of them
* test multiple gcd primes.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 21:43:31 +01:00
Daira Hopwood 6c0f7ab40a amicable.sage: make executable.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 21:37:50 +01:00
Daira Hopwood 3dd5b562e1 amicable.sage: the 2-adicity of p could be less than specified when using stretch
(doesn't affect Tweedle curves).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 21:32:27 +01:00
Daira Hopwood c6a6a04280 checksumsets.py: the fields of State can be just int, not Optional[int].
(The Optional was left over from a previous iteration of the code.)

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-24 12:56:05 +01:00
Daira Hopwood f761cc0833 Add animations.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-06-23 16:28:05 +01:00
Daira Hopwood 289e616084 checksumsets.py: add support for generating animations.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-06-23 16:27:52 +01:00
Daira Hopwood 5db9b7a1bc amicable.sage: fix minor bug in reporting whether bq is square (that did not affect the Tweedle curves).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-05-24 19:23:13 +01:00
Daira Hopwood d93cabbaf8 injectivitylemma6.py: fix bugs in comments.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-04-26 11:58:21 +01:00
Daira Hopwood e859145e33 verify.sage: tabs to spaces.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-04-25 18:21:59 +01:00
Daira Hopwood f1e73dab4f verify.sage: compatibility with Python3-based sage.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-04-25 18:13:20 +01:00
Daira Hopwood 5cbd39a77c amicable.sage: compatibility with Python3-based sage.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-04-25 17:38:14 +01:00
Daira Hopwood 035fd2b2ce Add a hexary version of injectivitylemma.py.
This is not used by the version of Halo in the paper.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-22 13:42:39 +00:00
Daira Hopwood 15f7108bbc README: be clearer about which version of the paper is obsolete.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-15 14:47:54 +00:00
Daira Hopwood 0ea400f339 checksumsets.py: if BRUTEFORCE_THRESHOLD is 0, don't call bruteforce_D
(and don't depend on bintrees in that case).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-23 11:36:02 +00:00
Daira Hopwood 3c69d7df58 injectivitylemma.py: add header comment.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-18 09:42:59 +00:00
Daira Hopwood daff0c4197 injectivitylemma.py: use namedtuple for clarity, and switch to Python 3.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-18 09:42:59 +00:00
Daira Hopwood c6e1112e1f injectivitylemma.py: change variable names to match paper.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-18 09:42:59 +00:00
Daira Hopwood a22a02e2a4
More precise about CM discriminant 2020-02-18 08:43:20 +00:00
Daira Hopwood 2f60aed1ce
Tweedledum/Tweedledee is fixed now 2020-02-18 08:40:54 +00:00