View
214
Download
0
Category
Tags:
Preview:
Citation preview
Crypto LaboratoryCrypto LaboratoryWinter 2007-2008Winter 2007-2008
Alexander Grechin and Zohar RogelAlexander Grechin and Zohar Rogel
Under supervision of Zvika BerkovichUnder supervision of Zvika Berkovich
Development technologyDevelopment technology
C# language (VS 2005) and Microsoft C# language (VS 2005) and Microsoft .NET framework 2.0.NET framework 2.0 Reflection technologyReflection technology Built-in graphics featuresBuilt-in graphics features Simple GUI generationSimple GUI generation
Purchased knowledgePurchased knowledge WeWe’’ve learned about some known ve learned about some known
ciphers and their historyciphers and their history Experienced in application development Experienced in application development
from the beginning to the endfrom the beginning to the end Learned additional skills in C# Learned additional skills in C#
programming languageprogramming language WeWe’’ve learned more about built-in ve learned more about built-in
abilities of C# such as drag-drop abilities of C# such as drag-drop feature and visual manipulation of feature and visual manipulation of simple graphicssimple graphics
IntroductionIntroduction
The purpose of this project is to create the demonstration program which allows: Encrypt and decrypt English texts Break encrypted English texts Build and execute strategy – a sequence
of operations Operation may be encryption, decryption or
cracking of some message with specific cipher and parameters
IntroductionIntroduction
The program contains a set of ciphers 4 ciphers
User can add his own ciphers User builds class that implements a
defined interface Received dll file copied to work directory
IntroductionIntroduction
There are two logical parts in the project: Build framework program that will supply
the user a convenient way to work with ciphers
Develop several ciphers and attach them to the framework program
Framework applicationFramework application
Allows the user to work with ciphers
There are two ways to use the application: Working using graphic interface – GUI
application Working in command line – Console
application
In both cases the single core is used
GUI ApplicationGUI Application
Allows the user to: Input and output texts Get log messages Execute single operation Build and execute strategy
Examples
Combined working scenarioCombined working scenario
User builds strategy in GUI application GUI application translates the strategy to
the format of Console application GUI application calls for command line User continues working in command line
Example
Cipher attaching Cipher attaching
Each cipher implemented as independent module and implements ICipher interface
Core module looking for these modules in current directory
Using Reflection mechanism the Core instantiates the ciphers
Ciphers pointed through ICipher interface
CiphersCiphers
Some simple ciphers were chosen: Shift cipher (Julius Caesar cipher) Transposition cipher (Rail fence cipher) Simple Substitution cipher Poly-alphabetic cipher (Vigenère cipher)
Julius Caesar cipherJulius Caesar cipher
Each letter in the plaintext is Each letter in the plaintext is replaced by a letter at some fixed replaced by a letter at some fixed number of positions down the number of positions down the alphabetalphabet
For example, with a shift of 3:For example, with a shift of 3: A -> DA -> D B -> EB -> E
Rail fence cipherRail fence cipher
The plaintext is written downwards on The plaintext is written downwards on successive "rails" of an imaginary fence, successive "rails" of an imaginary fence, then moving up when we get to the bottom. then moving up when we get to the bottom. The message is then read off in rows.The message is then read off in rows.
Rail fence cipher - exampleRail fence cipher - example
Plaintext: transpositionPlaintext: transposition Number of Number of ““railsrails”” = 3 = 3
T S I NT S I N
R N P S T OR N P S T O
A O IA O I Cipher text: TSIN RNPSTO AOICipher text: TSIN RNPSTO AOI
Substitution cipherSubstitution cipher
Each letter in the plaintext is replaced by Each letter in the plaintext is replaced by a letter in the substituted alphabeta letter in the substituted alphabet
Creating substituted alphabet: writing out Creating substituted alphabet: writing out a keyword, removing repeated letters a keyword, removing repeated letters
Writing all the remaining letters in the Writing all the remaining letters in the alphabetalphabet
The plaintext is encrypted using the The plaintext is encrypted using the substituted alphabetsubstituted alphabet
Substitution cipher - Substitution cipher - exampleexample
Keyword: “zebras”Keyword: “zebras” Plaintext alphabet / Ciphertext alphabet :Plaintext alphabet / Ciphertext alphabet :
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ZEBRASCDFGHIJKLMNOPQTUVWXYZEBRASCDFGHIJKLMNOPQTUVWXY
Message:Message: flee at once. we are discovered!flee at once. we are discovered!
Encrypted message: Encrypted message: SIAA ZQ LKBA. VA ZOA RFPBLUAOAR!SIAA ZQ LKBA. VA ZOA RFPBLUAOAR!
Vigenère cipherVigenère cipher Consists of several Caesar ciphers in sequence Consists of several Caesar ciphers in sequence
with different shift valueswith different shift values Creating substituted alphabet: using a Creating substituted alphabet: using a
Vigenère table – alphabet written out in 26 Vigenère table – alphabet written out in 26 rows, each alphabet is shifted to the left by rows, each alphabet is shifted to the left by one letterone letter
Writing out a keyword in a cyclic way, opposite Writing out a keyword in a cyclic way, opposite to plaintextto plaintext
Each letter is substituted according to the Each letter is substituted according to the keyword and the tablekeyword and the table
Vigenère cipher - exampleVigenère cipher - example Using Vigenère table (see below) and Using Vigenère table (see below) and
a keyword:a keyword: Plaintext: Plaintext: attackatdawn attackatdawn Keyword: Keyword: LEMONLEMONLE LEMONLEMONLE Ciphertext: Ciphertext: LXFOPVEFRNHRLXFOPVEFRNHR
SummarySummary This project allowed us to purchase This project allowed us to purchase
knowledge about:knowledge about: Some ciphers encryption and decryption Some ciphers encryption and decryption
algorithmsalgorithms Some ciphers auto-crack algorithmsSome ciphers auto-crack algorithms Working with C# and .NET environment Working with C# and .NET environment
using VS 2005using VS 2005 Stages of application developmentStages of application development
Recommended