220 likes | 338 Views
Crypto Laboratory Winter 2007-2008. Alexander Grechin and Zohar Rogel Under supervision of Zvika Berkovich. Development technology. C# language (VS 2005) and Microsoft .NET framework 2.0 Reflection technology Built-in graphics features Simple GUI generation. Purchased knowledge.
E N D
Crypto LaboratoryWinter 2007-2008 Alexander Grechin and Zohar Rogel Under supervision of Zvika Berkovich
Development technology • C# language (VS 2005) and Microsoft .NET framework 2.0 • Reflection technology • Built-in graphics features • Simple GUI generation
Purchased knowledge • We’ve learned about some known ciphers and their history • Experienced in application development from the beginning to the end • Learned additional skills in C# programming language • We’ve learned more about built-in abilities of C# such as drag-drop feature and visual manipulation of simple graphics
Introduction • 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
Introduction • 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
Introduction • 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 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 Application • Allows the user to: • Input and output texts • Get log messages • Execute single operation • Build and execute strategy • Examples
Console Application • Allows the user building and execution of strategies only
Combined 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
Core module • Serves both applications • GUI application • Console application
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
Ciphers • 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 cipher • Each letter in the plaintext is replaced by a letter at some fixed number of positions down the alphabet • For example, with a shift of 3: • A -> D • B -> E
Rail fence cipher • The plaintext is written downwards on successive "rails" of an imaginary fence, then moving up when we get to the bottom. The message is then read off in rows.
Rail fence cipher - example • Plaintext: transposition • Number of “rails” = 3 T S I N R N P S T O A O I • Cipher text: TSIN RNPSTO AOI
Substitution cipher • Each letter in the plaintext is replaced by a letter in the substituted alphabet • Creating substituted alphabet: writing out a keyword, removing repeated letters • Writing all the remaining letters in the alphabet • The plaintext is encrypted using the substituted alphabet
Substitution cipher - example • Keyword: “zebras” • Plaintext alphabet / Ciphertext alphabet : • abcdefghijklmnopqrstuvwxyz • ZEBRASCDFGHIJKLMNOPQTUVWXY • Message: • flee at once. we are discovered! • Encrypted message: • SIAA ZQ LKBA. VA ZOA RFPBLUAOAR!
Vigenère cipher • Consists of several Caesar ciphers in sequence with different shift values • Creating substituted alphabet: using a Vigenère table – alphabet written out in 26 rows, each alphabet is shifted to the left by one letter • Writing out a keyword in a cyclic way, opposite to plaintext • Each letter is substituted according to the keyword and the table
Vigenère cipher - example • Using Vigenère table (see below) and a keyword: • Plaintext: attackatdawn • Keyword: LEMONLEMONLE • Ciphertext: LXFOPVEFRNHR
Summary • This project allowed us to purchase knowledge about: • Some ciphers encryption and decryption algorithms • Some ciphers auto-crack algorithms • Working with C# and .NET environment using VS 2005 • Stages of application development