## std::crypto::elgamal_ecgfp5
| Procedure | Description |
| ----------- | ------------- |
| gen_privatekey | Generates the public key, point H
the private key is expected as input and is a 319-bit random
number of 10 32-bit limbs.
|
| encrypt_ca | Given a random scalar r on stack
this routine computes the first elliptic curve point C_a
C_a = r*G, G is the generator of elliptic curve
Expected stack state
[r0, r1, ..., r9]
Final stack state
[Ca_x0, ..., C_x4, Ca_y0, ..., Ca_y4, Ca_inf]
|
| encrypt_cb | Given public key, point H generated in gen_privatekey as coordinates (X,Y) on stack
and message M, elliptic curve points (a,b) also as coordinates (X,Y) on stack
and random scalar r on stack
this routine computes the second elliptic curve point C_b
C_b = M + r*H
Expected stack state
[H_x0, ..., H_x4, H_y0, ..., H_y4, H_inf, r0, r1, ..., M_x0, ..., M_x4, M_y0, ..., M_y4, M_inf,]
Final stack state
[Cb_x0, ..., Cb_x4, Cb_y0, ..., Cb_y4, Cb_inf]
|
| remask_ca | Rerandomises the first half of an ElGamal ciphertext Ca
and random scalar r to produce a rerandomised ciphertext C'a
Expected stack state
[r0, r1, ..., Ca_x0, ..., Ca_x4, Ca_y0, ..., Ca_y4, Ca_inf, ...]
Final stack state
[C'a_x0, ..., C'a_x4, C'a_y0, ..., C'a_y4, C'a_inf]
|
| remask_cb | Rerandomises the second half of an ElGamal ciphertext Cb given a public key H
and random scalar r to produce a rerandomised ciphertext C'b
Expected stack state
[H_x0, ..., H_x4, H_y0, ..., H_y4, H_inf, ..., r0, r1, ..., Cb_x0, ..., Cb_x4, Cb_y0, ..., Cb_y4, Cb_inf]
Final stack state
[C'b_x0, ..., C'b_x4, C'b_y0, ..., C'b_y4, C'b_inf]
|