All published worksheets from http://sagenb.org
Image: ubuntu2004
Check the book's example of a Weil pairing using sage's routine:
The book's two points are , which is for us, and $(121,387)-P-Q$:
This means that the Weil pairing in the book should be the square of the Weil pairing of and that we compute.
This is the value that the book finds for the Weil pairing of its two points.
This is the expected answer. Note that sage understands that the output is a number mod .
Now we try a very serious example, taken from a paper by my former student Dave Freeman:
Thus is a fairly large ( bits) prime number.
Thus the order of over GF is a prime number whose size is roughly that of .
This implies that the embedding degree is in this case.
As expected, the ratio is a whole number. The following command seems to "take forever" on my laptop, so I don't want to run it:
Here is some distortion, starting with (random prime less than 1000, turned out to be 3 mod 4):
This should be no surprise! When you take over the field with elements, and is mod , you get a supersingular elliptic curve! We didn't like such curves because of the low embedding degree, but now we like them....
One generator is ; this was output the last time I ran the command!
This is one point of order . Note that "gens" is not deterministic, so you can get difference generators when you apply the command twice in a row.
Now let's reproduce the book's example.
One generator of the group of points is ; gotten by a previous application of the commands that are above.
The book finds instead of our point . Their point is times ours! We can find this by running the following command:
The root of unity in the book should be our zeta to the power .
And it is---on the nose!
Now let's do a "one-round three-way key exchange"with Alice, Bob and Connie; assume their secrets are 12, 34 and 56, respectively.
These three points are published for all to see.
The three people Bob, Alice, Connie have a shared secret . What they do with this is their own business.
END OF COURSE!