Cryptography is the science of encoding messages or information in such a way that only authorized parties can read it.
In an encryption scheme, the message or information, referred to as plaintext, is encrypted using an encryption algorithm, generating ciphertext that can only be read if decrypted.
Decryption is the reverse process to Encryption. Decryption creates a Plaintext from a Ciphertext only and only if the keys is known .
3. Implementing Vigenere cipher using
logic gates
contents :
1-Aknowlegment
2-Introduction to cryptography
3-Historical timeline
4-Veginere cipher
5-Project parts
5.1-Input
5.2-Adder
5.3-Mermory
5.4-Correction Circuit
5.5-Display
5.6-Power
6-Notes on ic’s
7-References and resources
4. 1-aknowlegment
Prof. Nesreen I. Ziedan
Computer and Systems Engineering Department
Zagazig University
For giving us the chance to live this wonderful experience
Prof.Dan Boneh
computer science
stanford university
For providing us with the theoretical basis through his great mooc on corsera platform .
5. 2-Cryptography
Cryptography is the science of encoding messages or information in such a way that only authorized parties
can read it.
In an encryption scheme, the message or information, referred to as plaintext, is encrypted using an
encryption algorithm, generating ciphertext that can only be read if decrypted.
Decryption is the reverse process to Encryption. Decryption creates a Plaintext from a Ciphertext only and
only if the keys is known .
Cryptography has a wide range of applications : Electronic Money , Secure Network Communications ,
Electronic Signatures and of caurse military applications .
Spies, soldiers, hackers, pirates, royalty, merchants, tyrants, political activists, Internet shoppers, and
anyone who has ever needed to share secrets with trusted friends have relied on cryptography to make sure
their secrets stay secret.
6. 3-History of cryptography:
it’s clear that the need of secret way of writting was demanding since early ages such that most of the
ancient civilizations had there own cryptography machines .
ancient roma : Julius Caesar used what is know after him - Caesar cipher- in which each letter in the
plaintext was replaced by a letter some fixed number of positions further down the alphabet. Suetonius
reports that Julius Caesar used it with a shift of three to communicate with his generals.
The Greeks of Classical times are said to have known of ciphers (e.g., the scytale transposition cipher
claimed to have been used by the Spartan military).
transposition ciphers, which rearrange the order of letters in a message (e.g., 'hello world' becomes
'ehlol owrdl' in a trivially simple rearrangement scheme).
Reconstructed ancient Greek scytale
Ancient Egypt
Atbash is an example of an early Hebrew cipher. The earliest known use of cryptography is some
carved ciphertext on stone in Egypt (ca 1900 BCE).
In India, the 2000-year old Kamasutra of Vātsyāyana speaks of two different kinds of ciphers called
Kautiliyam and Mulavediya. In the Kautiliyam, the cipher letter substitutions are based on phonetic
relations, such as vowels becoming consonants. In the Mulavediya, the cipher alphabet consists of
pairing letters and using the reciprocal ones.
7. 4-veginere cipher
It was possibly first described in 1553 by Italian cryptographer Giovan
Battista Bellaso (though it has been reinvented many times, including by
Blaise de Vigenère). It is thought to have remained unbroken until Charles
Babbage, considered to be the father of computers, broke it in the 19th
century.
Blaise de Vigenère
The Vigenère cipher consists of several Caesar ciphers in sequence
with different shift values.
Algebraic description:
8. 5-PROJECT LAYOUT
•letters are represented in integer numbers , from 1 to 26
•character's are received as ascii codes from ps/2 keyboard and then modulated using Arduino
into corresponding integers
•key character's are saved in the memory while text head to the adder where it’s simply added
to the key
•the modulo function as achieved using the correction circuit
•integers are transformed back into ascii and finally displayed on LCD
9. 5.1-Input
The project uses ps2 keyboard
physically , ps2 connector consisits of 6 pins as shown below .
data (ASCII code ) are transmitted serially over one line synchronous with a clock which
make a challenge to transform it into parallel form .
10. This problem was solved using Arduino giving
an output of five data lines for five data bits
representing all the 26 English character's .
Arduino code :
#include <LiquidCrystal.h>
#include <PS2Keyboard.h>
//LiquidCrystal lcd(A0 , A1, A2, A3,A4, A5);
const int DataPin = 8;
const int IRQpin = 3;
PS2Keyboard keyboard;
void setup() {
pinMode(7, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
pinMode(A3, INPUT);
pinMode(A4, INPUT);
11. pinMode(A5, INPUT);
pinMode(6, OUTPUT);
keyboard.begin(DataPin, IRQpin,
PS2Keymap_US);
Serial.begin(9600);
Serial.println("Enter your text: ");
// lcd.println("Enter your text: "); }
void loop() {
int y;
digitalWrite(6,LOW) ;
if (keyboard.available()) {
char c = keyboard.read();
int x=int(c)-96;
Serial.print(c);
Serial.print(" ");
Serial.println( x);
// lcd.print(c);
// lcd.display(); // convert character
from keyboard to binary start from 0 to 25
13. 5.2-Adder
A Long - term outlook would show an overflow problem that takes another bit being added to the
five data bit .
overcoming this problem . two-four- bit full adder can simply add the text and key characters
generating the cipher text or subtracting them and retrieving plain text again .
the full adder ic is 74HC283 which is a 4 bit full adder with fast carry
six xor gates are used to add the functionality of suntraction( Decrption ).
the xor ic is 74LS86
both of the xor and the full adder make ripple adder capable of encrypting and decrypting
massages .
14. 5.3-Mermory
A small (8*5 bit ) memory is built using 5 ic each contains 8 latches .
Used to save the key such that each character is saved in parallel in the five ic’s .
the latches ic can work on four modes controlled by 2 enable lines
the latches shows the stored bit all the time so in order to read one character , 5 multiplexer are
used.
A counter is used to address the memory , such that it’s activated with each key stroke .it also
plays a vital role when entering the plain text.
15. 5.4-Correction Circuit (round robin )
Consists of detection and a ripple adder
The detection circuit detects error resulting from the absence of the modulo function
and reports with a single bit flag .
The ripple adder adds or subtract 26 depending on the operation, encryption or decryption
****************************
normally ... the input of the xor gates is -26 and one flag (ENC/DEC) . in case ENC , the flage is zero so
the input to the adder is 26.
in case of DEC , the flag is 1 so the input to the adder is 26.
16.
17. 5.5-Display
Again with the five data bit representing integers from 1 to 26.. the arduino transforms this output
into ASCII code which is displayed on the LCD.
The Arduino has an enable to read every key stroke .
18. 5.6-Power
The project uses 17805 which has a fixed output of 5 volt and mac current of 1.5 amperes.
This ic is going to power the ic’s of the circuit and it’s fed from a 9 volt battery.
The arduino is directly connected to a 9-volt battery.
19. 6-Notes on ic’s :
The projects uses 74HC family which is CMOS technology,, it has a propagation delay of 9 ns and
toggle speed of 50MHz .
The typical supply voltage is 5 volt anf the consumption of the gate per 1MHz is 0.5mW .
20. 7-Refrences and Resouces
1- Cryptography…. mooc …. stanford university
https://www.coursera.org/course/crypto
2-Cryptography…. mooc …. University of Maryland
https://www.coursera.org/course/cryptography
3-Hacking Secret Ciphers with Python: A beginner's
guide to cryptography and computer programming with
Python