If you need a public key encryption system compatible with snarkyJS, I would suggest a hybrid cryptosystem using the Pallas curve (the Group
type in snarkyJS) for the public key part, and Poseidon for the symmetric part.
To give a bit more detail:
- a private key would be a scalar field element
x
- the corresponding public key would be the group element
Group.generator.scale(x)
.
Let's say a message is an array of field elements msg: Array<Field>
against a public key h: Group
. In pseudcode:
type CipherText = {