Maple worksheets for cryptography

shoulderslyricalΤεχνίτη Νοημοσύνη και Ρομποτική

21 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

100 εμφανίσεις


Maple worksheets for cryptography

© 2007, Mike May, S.J., maymk@slu.edu


This collection of worksheets was written for an upper division mathematics course at
Saint Louis University aimed at sophomores and juniors. The course used


Cryptography
with Cod
ing Theory, by Trappe and Washington (second edition,
ISBN
-
13: 978
-
0131862395
)
as a textbook and that book is referred to at various places in the worksheets. All the
worksheets have been revised to work with Maple 11.



Section 0
-

Preliminary Worksheets


The first two worksheets are designed to
introduce the student to Maple. They cover nonmathematical issues like cutting and
pasting, creating prompts and putting more than one command in an execution
section. Experience has shown that it is worthwhile
to cover this material before
moving on to the mathematics of cryptography.

1) JustEnoughMapleWorksheets.mw


A brief introduction to using Maple in
worksheet mode.

2) Writingmaple11Documents.mw


A brief introduction to using Maple in Document
mode,


Sect
ion 1
-

Classic Ciphers


The next eight worksheets look at classical cryptographic
systems, like mono
-
alphabetic ciphers and variations on them as well as onetime pads
with pseudo
-
random strings. These systems are unsophisticated mathematically and
are ea
sily cracked. They allow the development of a number of important
mathematical concepts (e.g., key space, frequency analysis of standard English), and
walk the students up a learning curve with related computational skills (e.g., changing
data type to pe
rform operations, working with strings and arrays).

1) 1
-

CaesarCode1.mw


An introduction to the Caesar cipher with an explanation of
procedures that rotate the ASCII alphabet and ones that leave special characters
and spaces alone. Some package commands

are also introduced.

2) 2
-
CaesarCode2.mw


This worksheet extends the techniques of CaesarCode1.mw to
work with all mono
-
alphabetic ciphers.

3) 3
-
FrequencyAttacks.mw


This worksheet explores several uses of frequency counts
to attack mono
-
alphabetic ciph
ers, first simply looking for common letters, then
using the dot product on a normalized frequency vector to automate the attack.

4) 4
-
VignereEncryption.mw


This worksheet both develops the Vigenere cipher and
develops automated attacks against the cipher

5) 5
-
TypeConversion.mw


This is a technical worksheet that looks at conversions of
data type. In a course on cryptography message may need to be considered as: a
string of ASCII characters; a string on elements of Z_n where n may be 26 or 256;
a string
of bytes represented in either binary or hexadecimal, a collection of
blocks of data with block length being 56, or 64, or 256 bits; a string of vectors
over the field Z_2; a string of polynomials over Z_2; or a string of elements of
GF(256). This workshe
et looks at converting from one data type to another.

6) 6
-
HillCipher.mw


This worksheet looks at the Hill cipher, where a matrix is used to
encrypt blocks of letters.

7) 7
-
PsuedoRandom.mw


This worksheets explores several techniques where
cryptography i
s done with a one time pad using a pseudo random string of bits as
a mask. Blum
-
Blum
-
Shub and linear feedback shift registers are both discussed.

8) ClassicTeacher.mw


A worksheet that collects tools used in the worksheets on
classical systems so a teach
er would have them near at hand.


Sections 2
-

Public Key Cryptography



The next 16 worksheets concern methods of
public key cryptography. They introduce both RSA and the El Gamal cryptographic
systems. A lot of time is also spent considering methods of

primality testing and
factoring methods. Several worksheets are designed for teachers to make it easy to
generate test questions.

1) 1
-
RSA.mw


An introduction to the RSA cryptographic system

2) 2
-
PrimeTest.mw


This worksheet covers the Fermat and Mille
r
-
Rabin tests of
primality and introduces Carmichael numbers.

3) 3
-
CheckPrimeTest.mw


Looks at the effectiveness of the Fermat and Miller
-
Rabin
tests for candidates that have the order of magnitude we are interested in for
public key cryptography. These
tests are remarkably effective.

4) 4
-
MillerRabinLiars.mw


Looks at the number of Miller
-
Rabin liars with
Carmichael numbers and uses discreet logs to give a method for predicting the
number of liars.

5) 5
-
FactorizationExamples


This worksheets looks at s
pecial factorization techniques
can be used to factor some composite numbers. This lets us understand how to
choose p and q so that n is not easily factorable. In particular the Fermat, p
-
1, and
Miller
-
Rabin methods are used to factor composites that are

bigger than a size
easily handled by Maple.

6) 6
-
QuadSieveEx.mw


This worksheet walks the user through three examples of
using the quadratic sieve technique of factoring. It also explains how the process
would be set up in larger problems.

7) 7
-
ElGamal.
mw


This worksheet shows how to use the El Gamal cryptographic
system. It addresses methods for reasonably finding a generator for the
multiplicative group when p is large enough to be used in public key
cryptography.

8) 8
-
PohligHellmanEx.mw


This works
heet looks at the Pohlig
-
Hellman method for
finding a discreet log when p
-
1 is a product of small primes.

9) 9
-
PohligHellmanMany2.mw


This worksheet walks through the Pohlig
-
Hellman
method for finding discreet log when p
-
1 is a power of 2

10) 10
-
Birthday
AttackDiscreetLog.mw


This worksheet walks the student through the
birthday attack method for finding discreet logs. It allows a student to easily
work examples when p is 6 or 7 digits.

11) 11
-
EllipticFactoring.mw


This worksheet walks the students thro
ugh the use of
elliptic curve computations and the use of elliptic curves to factor numbers. The
assigned exercises have the students factoring products of 10 digit primes with
elliptic curves.

12) Carmichael.mw


A worksheet for generating Carmichael num
bers. Intended for
teachers who are generating examples.

13) TestProbGenerator
-
PublicKey.mw


A worksheet for generating problems of an
appropriate level of difficulty in topics in public key cryptography.

14) SafePrimes.mw


A worksheet for generating sa
fe primes or primes where p
-
1 has
a large prime factor.

15) RSADemo.mw


This worksheet uses components to demonstrate RSA with all the
code hidden.

16) CryptoCoins.mw


This demonstrates a method where cryptographic techniques
can be used to flip a coin a
t a distance. In particular it allows the person who calls
to coin toss to have confidence in the honesty of the other person’s reporting
whether or not the call was correct.


Section 3
-

Symmetric Cryptography

-

The remaining 14 worksheets walk the user
through three systems of symmetric cryptography, a simplified DES like systems that
will be referred to as baby DES, the classical symmetric system DES, and AES or
Rijndael. BabyDES is included because it is simple enough to do by hand but
illustrates the

key components of a symmetric system. DES is a standard for
understanding commercial cryptographic systems. AES is the current standard. In
each case the worksheets walk through first producing procedures that will encrypt
and decrypt messages with the

system, then walking through various topics with that
system. The goal of the series of worksheets was that a student would be able to
produce a worksheet to encode with another

1) 1
-
BabyDES
-
Intro.mw


The first worksheet starts by working through an en
cryption
with BabyDES taking each step one at a time and then creating commands to
encrypt in a single step. The worksheet also takes a first look at differential
cryptanalysis.

2) 2
-
BabyDES
-
Diff.mw


This worksheet takes an in depth look at using differe
ntial
cryptanalysis with BabyDES

3) 3
-
BabyDES
-
Stats.mw


The third worksheet with BabyDES looks at diffusion and
does a statistical analysis of how many rounds we need to use so that “every bit of
the ciphertext is equally dependent on each bit of the pla
intext and each bit of the
key. The methods used here for statistical analysis can easily be adapted for other
block ciphers.

4) 1
-
DES
-
ConstantFunctions.mw


The first DES worksheet establishes the constants
and functions needed to encrypt and decrypt wit
h DES. It is intended to save
these values so they can be read in for use with other DES worksheets.

5) 2
-
DES
-
KeyExpansion.mw


The second worksheet walks through the process of
expanding a key into a series of round keys.

6) 3
-
DES
-
Example.mw


The third
worksheet walks through the encryption and
decryption of a single block of plaintext with DES.

7) 4
-
DES
-
Modes.mw


The fourth worksheet in the series looks at how DES is used in
various modes to encrypt longer message. In particular electronic codebook,
c
ipher block chaining, cipher feedback and output feedback modes are explored.

8) 5
-
DES
-
StatTest.mw


The last DES worksheet walks through a statistical analysis
that examines the idea that each bit of the plaintext and key is equally likely to
change each
bit of the ciphertext.

9) 1
-
AES
-
SavingFunctionsConstants.mw


Once again, the first worksheet in the series
creates constants and commands that we will want to use with AES and saves
them where they can be easily loaded for use with other worksheets.

10) 2
-
AES
-
SBoxCreation.mw


This worksheet walks through the creation of the S
-
boxes.

11) 3
-
AES
-
KeyExpansion.mw
-

The third worksheet in the AES series looks at the
expansion of key into a series of round keys.

12) 4
-
AES
-
Encryption.mw


The fourth worksheet i
n the series walks through
encryption and decryption with AES.

13) 5
-
AES
-
VariableTextTest.mw


The fifth worksheet in the AES series uses the data
presented with the original AES submission to verify that the Maple version of
AES we created is doing encryp
tions and decryptions correctly.

14) 6
-
AES
-
BitDist.mw


The final worksheet on AES does a statistical analysis on the
diffusion produced by AES.