A.2 Some Commands

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 {x, y} and {u, v} on the elliptic curve y2x3+bx+c (mod n), where n is odd.

affinecrypt[txt,m,n] affine encryption of txt using mx+n.

allshifts[txt] gives all 26 shifts of txt.

ChineseRemainder[{a,b,...},{m,n,...}] gives a solution to the simultaneous congruences xa (mod m), xb (mod n), .

choose[txt,m,n] lists the characters in txt in positions congruent to n (mod m).

coinc[txt,n] the number of matches between txt and txt displaced by n.

corr[v] the dot product of the vector v with the 26 shifts of the alphabet frequency vector.

EulerPhi[n] computes ϕ(n) (don’t try very large values of n).

ExtendedGCD[m,n] computes the gcd of m and n along with a solution of mx+ny=gcd.

FactorInteger[n] factors n.

frequency[txt] lists the number of occurrences of each letter a through z in txt.

GCD[m,n] is the gcd of m and n.

Inverse[M] finds the inverse of the matrix M.

lfsr[c,k,n] gives the sequence of n bits produced by the recurrence that has coefficients given by the vector c. The initial values of the bits are given by the vector k.

lfsrlength[v,n] tests the vector v of bits to see if it is generated by a recurrence of length at most n.

lfsrsolve[v,n] given a guess n for the length of the recurrence that generates the binary vector v, it computes the coefficients of the recurrence.

Max[v] is the largest element of the vector v.

Mod[a,n] is the value of a (mod n).

multell[{x,y}, m, b, c, n] computes m times the point {x, y} on the elliptic curve y2x3+bx+c (mod n).

multsell[{x,y}, m, b, c, n] lists the first m multiples of the point {x, y} on the elliptic curve y2x3+bx+c (mod n).

NextPrime[x] gives the next prime>x.

num2text0[n] changes a number n to letters. The successive pairs of digits must each be at most 25; a is 00, z is 25.

num2text[n] changes a number n to letters. The successive pairs of digits must each be at most 26; space is 00, a is 01, z is 26.

PowerMod[a,b,n] computes ab (mod n).

PrimitiveRoot[p] finds a primitive root for the prime p.

shift[txt,n] shifts txt by n.

txt2num0[txt] changes txt to numbers, with a=00, , z=25.

txt2num[txt] changes txt to numbers, with space = 00, a=01, , z=26.

vigenere[txt,v] gives the Vigenère encryption of txt using the vector v.

vigvec[txt,m,n] gives the frequencies of the letters a through z in positions congruent to n (mod m).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.193.158