The Hardware Side of Cryptography

26 March 2008

The Implementation of Vigenere Cipher on PIC16F84

Filed under: encryption — Tags: , , , — edipermadi @ 10:09 pm

Today, i was reading the “CRYPTOLOGIA History” book. I found nice classical cipher named “vigenere”. This cipher was invented by Blaise de Vigenère. Although this cipher is insecure, lets just code it for the sake of curiosity.

This post is dedicated to provide an example to anyone who is looking for the implementation of Vigenère cipher in hardware, especially on PIC16F84 the PICmicro Microcontroller from microchip. Hopefully this piece will benefit to anyone, at least to satisfy myself :D .

This cipher mechanism is based on substitution table. The substitution table consisted of columns and rows labelled “A” to “Z”. To get cipher test, first you select the column of plain text and then you select the row of key. The intersection of row of column is called cipher text then. To decode cipher text, you select the row of key and you find the intersection which is equal to cipher text, the label of column is called plain text then. Simple right :) .

Vigenere Cipher Substitution Table

Above is the substitution table of vigenere cipher. I also took the screenshot of testing the algoritm on MPLAB 8. The picture is below:

Enciphering / Encoding Screenshot

Vigenere Cipher Enciphering Screenshot on MPLAB 8

Deciphering / Decoding Screenshot

Vigenere Cipher Deciphering Screenshot on MPLAB 8

Cheers  :)

BENCHMARK

Test Vector

Encryption:

Plain Text : I AM TRYING TO HIDE THIS MESSAGE FOR YOU
Key: HOPEFULLY NOBODY COULD READ THIS TEXT
Cipher Text: POBXWSTYEGCIWGCVVCDPVWSDZLNGKCLN

Decryption:

Cipher Text: POBXWSTYEGCIWGCVVCDPVWSDZLNGKCLN
Key: HOPEFULLY NOBODY COULD READ THIS TEXT
Plain Text: I AM TRYING TO HIDE THIS MESSAGE FOR YOU

Speed Test:

Encryption : 870 cycles / 32 characters
Decryption : 902 cycles / 32 characters

RELATED STUFF

Download
Source Code v1.0
Source Code v1.1
PIC16F84 Datasheet
Mid-Range Reference Manual

References:
Wikipedia Vigenère Cipher

Official Website:
- Microchip

Simulator
Vigenere Cipher Simulator

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

Blog at WordPress.com.