jkrypto - a Program for Creating and Analysing Classical Ciphers

jkrypto is a Java program which can be used to create and analyse classical substitution and transposition ciphers. It is a rewrite of a much older program krypto. The current version of this program is jkrypto v4.3. It was originally written to support students in my Cryptography courses in completing a classical ciphers lab.

You can use jkrypto to en/decrypt text messages using either a mono or polyalphabetic vigenere, beauford or general substitution cipher, using an alphabetic key to specify the alphabets; or using a row or column transposition cipher given a key which is either a word or a permutation.

You can also use jkrypto to analyse ciphers of these forms by tabulating or graphing frequency distributions and computing IC's over 1 or multiple alphabets; searching for repeated strings of a specified size to implement the kasiski method; exhaustively searching all row or column permutations to match a search string to break these transpositions, and to reformat the data into a specified block size and number per line. These can be used to assist an analyst to break modest sized ciphers of these types.


Installing jkrypto on your own System

To run jkrypto you then need to upload and save into the same directory, the following files:

jkrypto.jar
a Java JAR file which contains all the compiled program class files. This is an executable jar file, which may be run directly if your system knows how to do this, or by using the command: java -jar jkrypto.jar

Alternatively you may be able to simply open the file (if your O/S knows how to run applications in jar files). Otherwise you will need one of the following script files (which simply contain the command above) to run the program:

jkrypto
a Unix shell script which runs the program using the above command (with the possiblility of specifying some options for debugging or correct display on various systems). After copying, you may wish to edit this file to specify the full name for the JAR file, so the program may be run from anywhere. You also need to make it executable.
jkrypto.bat
a DOS batch file which runs the program using the above command. After copying, you can edit this file to specify the full name for the JAR file, so the program may be run from anywhere.

To use the program you need to have a Java 1.5 (or later) runtime system installed, which may be obtained from the Oracle Java site - http://www.oracle.com/technetwork/java/javase/overview/ site.

After installing the JDK on Windows, you may need to edit your autoexec.bat file to add the location of the binaries to the PATH environment variable. Similarly on Unix systems, you need to edit the appropriate shell startup file to do likewise.


Using jkrypto

To use jkrypto you can invoke it either with or without a filename argument:

See the GUI Help file for information on the commands available when it is run using the GUI interface.

Alternatively the following commands are available in command-line mode.

Command           Meaning
?                 - this message.
q                 - exit.
v                 - toggle verbose displays.
r [file]          - enter code from file.
w [file]          - write code to file.
u                 - undo previous modification.
z                 - reset the code to its initial state.

f <p>             - display frequency counts (for period p).
g <p>             - display frequency graphs (for period p).
i <p>             - calculates the index of coincidence (for period p).
k [seqlen]        - perform kasiski method on text for length seqlen.
l [b B]           - display in (b) block with (B)blocks per line.
p <n>             - display current text (in n alphabets).

S <-> -[gvb] key  - Encrypt or decrypt using specified
                    general, vigenere, beauford substitution cipher, given key.
s [ch1] [ch2]     - substitute ch2 for ch1.

T <-> -[rcn] key|perm - Encrypt or decrypt using specified
                    row, column, nihilist cipher, given keyword or perm.
t -[rcn] n regexp - look for row/col transpositions of period n
                    optionally matching regular expression or text.

Authorship & Copyright

This version of the jkrypto program was written by Lawrie Brown 2002-2005, adapted from the original code by Daryl Bossert, both at ADFA, Canberra Australia. Lawrie's code is Copyright © 2005 by Lawrie Brown. Permission to use this program as desired is granted, provided due acknowledgement is given of the authors and source of the program.


References

For additional information, see:
  • Lawrie Brown's ADFA Cryptography course notes
  • J Pieprzyk, T Hardjono, J Seberry, "Fundamentals of Computer Security", Ch 3, 1/e, Springer-Verlag, 2003.
  • A Sinkov, "Elementary Cryptanalysis", Chs 1,2,3,5, New Mathematical Library, Random House, 1968
  • W Stallings, "Cryptography and Network Security", Ch 2.1-2.3, 5/e, Prentice-Hall, 2010.
  • D Stinson, "Cryptography: Theory and Practice", Ch 1, CRC Press, 1995

  • [Back to Programs]
    Lawrie.Brown@adfa.edu.au / 26 Apr 2012