]> git.codecow.com Git - Monocypher.git/commit
Replaced fast mappings by even better ones
authorLoup Vaillant <loup@loup-vaillant.fr>
Wed, 26 Feb 2020 21:14:57 +0000 (22:14 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Wed, 26 Feb 2020 21:14:57 +0000 (22:14 +0100)
commit5cfb772a7440bcbc1005213d0483d7d1cc770367
tree086f936d31c33108ec540679dfd575c6e6be6706
parent76763506e64aeb92e3b6d4c2b1d16123c2afbe64
Replaced fast mappings by even better ones

Turned out there were much simpler ways to compute the mapping, thanks
to the fact that when the prime p is congruent to 5 modulo 8, we have
this nice equality:

    x^((p-5)/8) = sqrt(1/x)          if x is square,
    x^((p-5)/8) = sqrt(sqrt(-1)/x)   otherwise

The code was kindly given by Andrew Moon, who got the original trick
from Mike Hamburg.
tests/gen/elligator.py