herumi / mcl

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

Consider exposing mapToG2 in wasm build #43

Closed wemeetagain closed 5 years ago

wemeetagain commented 5 years ago

It would be useful to use our own hashing scheme and use mapToG2 directly as in this example

Currently impossible in wasm build as mapToG1, mapToG2, Fp, Fp2, etc. are not exposed.

herumi commented 5 years ago

I do not expose mapToG1 because it is necessary to expose Fp, too. How about bytesToG1(G1& P, const void *buf, size_t bufSize); which means Fp x; x.setArrayMask(buf, bufSize); mapTo(P, x); ?

wemeetagain commented 5 years ago

Yes, this would be great! We would be happy to serialize our own Fp, Fp2 to arrayBuffer/Uint8Array and use bytesToG1, bytesToG2.

herumi commented 5 years ago

I added some APIs. https://github.com/herumi/mcl-wasm/commit/10fa93af76aec9a04135e16cb9dff21b29d8747b

https://github.com/herumi/mcl-wasm/commit/49afc0e8f7df26f9e0f13fe35f93ea0b320d14f8

wemeetagain commented 5 years ago

:heart_eyes: :heart_eyes: thank you so much! This will help us immensely.