The following are tools to perform an Elliptic Curve El Gamal encryption.
Converting Letters to Numbers
Use the Text to Integer tools.
Find a prime number
If you are given a prime number, just put `p = …`
How to generate an elliptic curve in Sage over your prime field
The list is a list of coefficients: [0,a,0,b,c] for y^2 = x^3 + ax^2 + bx + c.
You can put the field of definition in the first spot, e.g. GF(7) or RR or QQ. If you write GF(7) that means the finite field with 7 elements, or Z/7Z.
Choose a point and give it a name
This is written in projective coordinates, so there’s a third entry, which is always 1 (except for the point at infinity).
Determine the multiplicative order of your point
Random Number Generator
randint(a,b) gives an integer between a and b inclusive
Find a square root mod p
If this Sage command returns a number (the example is square root of 2 mod 7), you have successfully gotten a square root. If it returns something that has the string `sqrt` in it, it is telling you there is no square root in GF(p).