The original Shallue-van de Woestijne mapping is implemented as per 6.6.1.
Mean gas cost of SVDW is ~22.6k.
Simplified SWU mapping is implemented as per 6.6.3 given
Without the required isoMap
, mapToPoint
only consumes ~16k gas. Unfortunately, the 59-isogeny is the lowest-degree curve isogenous to BN254, and so isoMap
dominates gas usage while also taking up a lot of contract bytecode.
Mean gas cost of SSWU is ~54.2k.
The addition chains in ModExp.sol
are borrowed from https://github.com/thehubbleproject/hubble-contracts/blob/master/contracts/libs/ModExp.sol.
See kevincharm/draft-irtf-cfrg-hash-to-curve#1 for reference implementation Sage scripts and to generate precomputed constants.