herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
450 stars 152 forks source link

Add MCL_MAP_TO_MODE_ETH2_LEGACY #132

Closed lithiumFlower closed 2 years ago

lithiumFlower commented 2 years ago

This pull request is to demonstrate backwards compatibility with commits before 730c50d4eaff1e0d685a92ac8c896e873749471b. Specifically mapToG2(G2, Fp2) when used with setMapToMode(MCL_MAP_TO_MODE_ETH2).

I believe this was changed to match the evolving eth2 draft specification at the time. I work on a program that has produced many cryptographic artifacts using this functionality and have recently updated mcl. For that I've written my own backwards compat function that does not rely on changes to the current mcl library. Unfortunately it uses the internals of mcl which are obviously subject to change. Would you consider supporting this behavior at the API level?

Here are the commits where the functionality was removed: https://github.com/herumi/mcl/commit/730c50d4eaff1e0d685a92ac8c896e873749471b https://github.com/herumi/mcl/commit/48860008cdd133222de6bc8cc6e26b95f8af209b#diff-9

herumi commented 2 years ago

Okay,I've merged it.