| Download
All published worksheets from http://sagenb.org
Project: sagenb.org published worksheets
Views: 168731Image: ubuntu2004
This worksheet introduces Sage as it would be useful to someone reading Hoffstein Pipher and Silverman's "An Introduction to Mathematical Cryptography"
The Section Numbers are those from the text.
Section 2.2 The Discrete Logarithms problem
We find a prime p and a primitive root modulo p: primroot
211
2
We make a discrete log function. Just the brute force one.
43
We get a list of the powers of primroot, and then use it to define the discrete log.
Look at the first 10 of them
[4, 8, 16, 32, 64, 128, 45, 90, 180]
4
132
Plot the discrete log. The plot(point( )) function needs a list of points: [ (1,1), (2,4), (3,9) ]