Brief Table of Content


Message to Instructors

The link below takes you to an instructor's resource page for the book. It contains some sample course outlines and information on how to obtain some useful instructor supplements. Instructor Resource Page


The link below brings you to a text file (created with Notepad) that contains the strings of ciphertexts that appear in Exercises and Exercises for the Reader in the first five chapters. From this file, readers can copy and paste ciphertext passages directly into the platform-independent applets (below) or into any other cryptographic programs.Ciphertexts

Platform-Independent Applets for Some Core Algorithms of Chapters 1-6

A very nice set of platform-independent applets has been created by Eric Flior for some of the core programs of Chapters 1-6. The applets were created with java. They should be helpful for readers by allowing them to do deeper investigations and examples without the distraction of lengthy hand computations. Some of the exercises of Chapter 5 should only be done with the applets from that chapter (or using the MATLAB/Octave/FreeMat programs that appear further down this page; readers with stronger computer backgrounds may instead write their own programs using the computer implementation suggestions that appear at the end of each chapter). Below is a brief list of the programs that are included for the corresponding chapters.

The chapter names below are links to the corresponding applet pages.

  • 1.1: Converting Strings of Digits to/from Vectors
  • 1.2: Converting Upper-Case Text to/from Integers
  • 1.3: Converting Lower-Case Text to/from Integers
  • 1.4: Shift Cipher
  • 1.5: Vigenere Cipher
  • 1.6: Random Integer Generator
  • 2.1: Prime Factorization of Positive Integers
  • 2.2: Successive Prime Finder
  • 2.3: The Division Algorithm
  • 2.4: The Euclidean Algorithm
  • 2.5: The Mod Function
  • 2.6: The Extended Euclidean Algorithm
  • 2.7: Finding Modular Inverses
  • 3.1: Affine Cipher Encryption and Decryption
  • 3.2: Computing Compositions of Permutations
  • 3.3: Computing Inverses of Permutations
  • 4.1: Matrix Operations
  • 4.2: Matrix Operations for Modular Matrices
  • 5.1: Frequency Counts
  • 5.2: Adjacent Letter Counts
  • 5.3 Ciphertext Partial Substitutions
  • 5.4 Modular Frequency Counts
  • 5.5 Extracting n-gram Data
  • 5.6 Horizontal Shifted Match Counts
  • 5.7 Horizontially Shifted Dot Products
  • 6.1 Binary / Hexadecimal / Decimal Converter
  • 6.2 Base n String Expansions
  • 6.3 Base b String Addition
  • 6.4 Base b String Subtraction
  • 6.5 Base b String Multiplication
  • 6.6 Fast Modular Exponentiation


Below are links to download individual programs for an assortment of algorithms and computer exercises from the book. The programs are written in MATLAB, which is a very user-friendly language, and many comments are included. (NOTE: In MATLAB, comments appear after "%" symbols since anything appearing in a line after this symbol is ignored by MATLAB.) More information on how these programs operate and how corresponding programs can be written in any computing platform can be learned by looking at the computer implementation material appearing at the end of each chapter. Some programs below give references to the computer exercises to which they correspond.

The cryptography programs below are set up to run on either MATLAB or the two free MATLAB clones Octave and FreeMat. Any program that has a single link "MATLAB/Octave/FreeMat" can be used with either platform (and this is the case for most of the programs). In a few cases some small changes were needed to make the MATLAB program run on Octave and/or FreeMat, and for such programs there are separate links "MATLAB" and "Octave/FreeMat" for the corresponding programs. When using Octave/FreeMat, a few programs require some auxilliary programs to run; there are only five of these, and a zipped folder containing them all can by downloaded using this link: Auxilliary Programs for Octave/FreeMat 
The cryptography programs can either be individually downloaded from the inventory list below, or more simply, the following two links will allow you to download a zip file of the entire folder/file configuration for either MATLAB users or FreeMat Users.

Download Entire MATLAB Cryptography Program Suite    

Download Entire Octave Cryptography Program Suite    

Download Entire FreeMat Cryptography Program Suite    

To view individual files below, left click your mouse to view the file in your internet browser window. To download the file in its original format, right click on the link and select a "save" or "save target" option. Even if you have never used MATLAB/Octave/FreeMat before; these cryptography programs are easy to use. For information on how to obtain MATLAB or FreeMat and how to set up these programs for use, refer to the following

MATLAB/Octave/FreeMat information page

The following link will allow you to download a text file that contains sample uses of all of the programs.

Brief Users Manual: Program Input/Output Demos

Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11

Scaled-Down AES Programs:
FULL AES Programs:
I am grateful Boian Kolev for having created the following programs and allowing them to be posted and shared on this cryptography webpage. To make the inner-workings of the programs easier to follow, rather than work with length 32 hex strings, several of these programs work with 4x4 matrices of integers in the range {0,1, ..., 255}, each corresponding to a pair of hex characters (= 1 byte). The pairs of hex integers are converted into their integer equivalents and filled into the matrix by columns. The program "toMatrix" below performs this transformation. Each of the remaining programs are similar to the corresponding scaled-down AES programs, but we will sometimes need to use this "toMatrix" program to illustrate some of them. See the "Program Input/Output Demos" page for more details on using these programs.
NOTE: For all of these full-AES programs, any inputted hex strings can be inputted either using the upper-case alphabet {A,B,C,D,E,F} or using the lower-case alphabet {a,b,c,d,e,f}. This is in contrast to the scaled-down AES programs above, which require to input strings using the upper-case alphabet. The outputted hex strings (ciphertexts) will still use the upper-case alphabet.
FINAL NOTE: Some of these programs depend on some built-in MATLAB functions that are present in Octave but not in FreeMat, so (only) this suite of programs for the full AES algorithm are designed and have been tested to work in both MATLAB and Octave. But most will not work in FreeMat.
Chapter 12