Open fkrause98 opened 1 year ago
Hey!
That's a great question. With EC ElGamal, it's a bit tricky to encode arbitrary strings in the plaintext, because the plaintext is, as you noticed, an elliptic curve point (e.g. Jubjub). One way to work around this would be add a str_to_group
function that maps (chunks of) strings first to Jubjub base field elements (i.e. Bls12-381 scalar field elements), and then map these to elliptic curve group elements.
This really good post describes some options to encrypt arbitrary string: https://crypto.stackexchange.com/questions/14955/mapping-of-message-onto-elliptic-curve-and-reverse-it. Let me know if it answers your question!
Thanks for the answer and the link, it really helps! Would it be easier If I had a fixed sized string, or even more so, a u8 array? What modules from this repo can I use to get started with implementing something like this?
Hi! First of all, if this issue is not meant to be here, please let me know.
That being said, I'm toying with the many repos of arkworks to try and create a gadget for asymmetric encryption using the ElGamal scheme, to then prove said encryption happened. I was mainly following the example from this test, but it generates 'msg' as a point on JubJub, right? I'd like to know if it is possible to use a string instead, that is, map the string to a point and then encrypt it.
I'm not that versed in cryptography, so correct me If I've said anything wrong, and feel free to point me in another direction if there's an easier way to do this.