## Cryptography and the Vigenere Cipher

Cryptography is an old game, and even better it has some extremely fascinating history. It’s use of mathematics most specifically modular arithmetic and transposition (things you will see often in the subject matter) is my favorite part. Although I wish it had some differential equations involved (my all time favorite study) when I see the mathematical challenges in cryptography I can’t resist.

WWII is where cryptography became a more serious force to be reckoned with; more complex polyalphabetic ciphers were put in play and even machines both mechanical and electromechanical began to aid faster encryption. Interesting story, a mathematician named Marian Rejewski was employed by the Polish Bureau to crack the German’s infamous Enigma machine. He used the theory of permutations and groups to crack the code which is considered one the biggest breakthroughs in cryptography history. Supposedly (and this is complete speculation) Winston Churchill knew about the planned bombing in Coventry but did nothing because he did not want the Germans to know the Enigma was cracked. I believe recently this has been debunked as a myth though.

If we go even further back in history, while there is even older evidence of cryptography in play, one of the most meaningful contributions is the Vigenere Cipher:

The “Father of Cryptography” Johannes Trithemius built the infamous “tabula recta” a polyalphabetic cipher that provided a progressive yet riggid and predictable system. This however, established a foundational framework for the next man, Giovan Battista Bellaso who made what we know today as the Vigenere Cipher, adding a repeating counter sign (key). Using modular arithmetic to encrypt and decrypt with a key you can see the process here:

http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher#Algebraic_description

I created in python a simple way to encrypt and decrypt the code, and you can find the files here:

https://github.com/CraigglesO/Ciphers

I hope to add to the list as many popular ciphers as I can. There is an international publication I can’t wait to get my paws on:

http://www.springer.com/computer/lncs?SGWID=0-164-6-134338-0

If anyone has some publications they would like to share please do. I would like to become more skilled in this area of study.

## Elementary OS

switching to Elementary OS was the best decision I’ve made. I am a huge fan of its simplicity, visual aesthetics, and a useful workflow. I’ve had a mac for a long time but my home computer is a PC, so of course I don’t want windows. Ubuntu as of late has been getting a little bulky and there has been a lot of competition with unity/gnome/emerald/etc but Luna takes all the best things you see in Ubuntu, and not only sticks with the highly efficient 12.04 Ubuntu kernel but also did all of the work of setting up an out of the box pleasant experience.

My setup:

IF Elementary interests you check out:

http://www.elementaryupdate.com

more specifically there post “Top Things to Do After Installing Luna”

very useful

Where I got the icon set:

http://deviantn7k1.deviantart.com/art/August-16-13-Desktop-393785413

I will post my conky setup in a later post…

another useful tip and lets be honest, in Linux you type “sudo apt-get install/update/etc” all the time, WHY? It’s useful to memorize the original method for communication purposes but there is such a simple method to simplify your terminal life… to do so:

open your files and in the Home directory press “CTR+H” to view hidden files. Open “.bashrc” and append (add to the end) these:

alias room=”gksudo pantheon-files”

#Shorten scratch name

alias scratch=”scratch-text-editor”

#shorten sudo install

alias sinstall=”sudo apt-get install”

#Shorten sudo update

alias supdate=”sudo apt-get update”

To turn .jpg files into ascii art in the terminal download ‘jp2a’

If the image file is not a .jpg use:

‘convert file.png newfile.jpg’

it may not be preinstalled software but the terminal will kindly let you know what you need to install.

## First Git Repository

https://github.com/CraigglesO/Hearts-Trick-Game

Very exciting day as a programmer. Starting to make my mark on the digital world.

I wrote this program in Python, I hope people take a look at it, took me quite some time.

One of the fun features I added to give quicker visual ques, cards allowed to be played have my initials inside them! 🙂

Ahhh, the little things…

Really, I created this program for educational purposes. Also, its always good to commit as many hours as possible to a new language to pickup the syntax faster.

661 lines of code

80+ hours to complete (probably more)

Difficulty level: Intermediate

About this code: The game is displayed in the terminal using ascii art to produce a means of objectifying the results The AI is extremely smart, I haven’t wont a game yet. Basically, I studied the best strategies for the game and mixed in that strategy with my own strategy to make the AI seem more organic The goal of making AI that’s hard enough has been achieved

Things still needed to be done:

• AI never tries to shoot the moon
• User input error printouts need improvement
• For expert AI I only need to make some revisions to the section where the AI makes a decision if no one else has played yet, as of right now the AI always chooses the first card

Things I would have done differently:

• I didn’t work in classes, that is a regret but this is the first program I have ever written in Python so it was a great learning experience regardless
• I realize now after seeing how other game developers create trick card games they always have one AI on expert, one AI on intermediate, and one AI on easy
• I guess this would be achieved with easy AI checking which cards are legally playable and choosing a random card. Intermediate would be somewhere in between.
• Since this is a trick card game and not for example chess, the user isn’t going to think about decision making for 10 minutes each card, so obviously the AI that can exhaust the best possible card in milliseconds can’t compare
• “5 minute games” than should have a mixtured AI for a more pleasurable experience

What I learned:

• How to implement decision exhaustive AI
• Improved list comprehensions in Python
• The usefulness of .sort for arrays
• unique difference in manipulation of String vs. Integer
• Expert level Heart strategy
• Added Array.extend(list) to my memories repertoire
• Use of try and except
• multi-dimensional arrays
• effective automated testing / debugging
• Inheritance vs. Composition
• etc.

Please leave feedback if you have suggestions or comments, this was purely created for educational purposes and any advice would be invaluable to me

~Craiggles