The following are some Mathematica commands that are used in the Computer Examples. The commands that start with capital letters, such as EulerPhi
, are built into Mathematica. The ones that start with small letters, such as addell
, have been written specially for this text and are in the Mathematica notebook available at
bit.ly/2u5R7dW
addell[{x,y}, {u,v}, b, c, n]
finds the sum of the points and on the elliptic curve , where is odd.
affinecrypt[txt,m,n]
affine encryption of txt using .
allshifts[txt]
gives all 26 shifts of txt.
ChineseRemainder[{a,b,...},{m,n,...}]
gives a solution to the simultaneous congruences .
choose[txt,m,n]
lists the characters in txt in positions congruent to .
coinc[txt,n]
the number of matches between txt and txt displaced by .
corr[v]
the dot product of the vector with the 26 shifts of the alphabet frequency vector.
EulerPhi[n]
computes (don’t try very large values of ).
ExtendedGCD[m,n]
computes the gcd of and along with a solution of .
FactorInteger[n]
factors .
frequency[txt]
lists the number of occurrences of each letter through in txt.
GCD[m,n]
is the gcd of and .
Inverse[M]
finds the inverse of the matrix .
lfsr[c,k,n]
gives the sequence of bits produced by the recurrence that has coefficients given by the vector . The initial values of the bits are given by the vector .
lfsrlength[v,n]
tests the vector of bits to see if it is generated by a recurrence of length at most .
lfsrsolve[v,n]
given a guess for the length of the recurrence that generates the binary vector , it computes the coefficients of the recurrence.
Max[v]
is the largest element of the vector .
Mod[a,n]
is the value of .
multell[{x,y}, m, b, c, n]
computes times the point on the elliptic curve .
multsell[{x,y}, m, b, c, n]
lists the first multiples of the point on the elliptic curve .
NextPrime[x]
gives the .
num2text0[n]
changes a number to letters. The successive pairs of digits must each be at most 25; is 00, is 25.
num2text[n]
changes a number to letters. The successive pairs of digits must each be at most 26; space is 00, is 01, is 26.
PowerMod[a,b,n]
computes .
PrimitiveRoot[p]
finds a primitive root for the prime .
shift[txt,n]
shifts txt by .
txt2num0[txt]
changes txt to numbers, with .
txt2num[txt]
changes txt to numbers, with space = 00, .
vigenere[txt,v]
gives the Vigenère encryption of txt using the vector .
vigvec[txt,m,n]
gives the frequencies of the letters through in positions congruent to .