Commit Graph

14 Commits

Author SHA1 Message Date
Daira Hopwood ad02b756cd Addition chains for 5^-1 (mod p-1, q-1).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-12-12 16:46:32 +00:00
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 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