Thursday, November 27, 2014

Let's do some crypto!

One of the more famous and widely used application of computer science is a cryptography. Idea behind core cryptography is fairly simple, keep my message secret.

The modern day cryptographic infrastructure as we know it, is mostly broken. The central idea behind this series is to make readers aware of these issues. The best way to do that is to actually break these systems. In this and the series posts that will follow, I will demonstrate attacks on different algorithms due to simple implementation errors or design issues in the algorithm itself.

This series is greatly inspired by Matasano Crypto Challenges. I strongly encourage you to go and solve them first, if you are looking for real action. I will be using those challenges as a reference. keep in mind that this work is strictly for educational purposes only.

Enough of the disclaimer and introduction, let's start!

Some words that you should understand 'out of the box'.


1. Plaintext: 'This is plaintext'.

2. Ciphertext: We operate on plaintext, and encrypt it.

3. Keys: Keys are the secret information that we use to restore ciphertext to extract meaningful data.

4. Keyspace: Collection of all  possible keys. Rule of thumb, size matters. Bigger the better.

5. Alice, Bob and Eve: Alice and Bob try to communicate, and Eve tries to listen. Pun intended.


Next post is on different ways of text representation, brush up your python skills. If you are not experienced in python, well don't worry I will teach you.


Credits:
Matasano Crypto Challenges.






Wednesday, July 9, 2014

Terminal Tricks : Cowsay and Fortune

When you start terminal, your operating systems runs few scripts to load your settings and initialize your terminal environment.

One of these files is ~/bash.bashrc .

You can edit this file to customize terminal to suit your needs.

We will be using two applications :

1. Cowsay

sumit@teardrop:~$ cowsay sumit
 _______
< sumit >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Cowsay draws a nice cow on your terminal with the dialog box of the text that you have as input.

2. Fortune

sumit@teardrop:~$ fortune

Sheriff Chameleotoptor sighed with an air of weary sadness, and then
turned to Doppelgutt and said 'The Senator must really have been on a
bender this time -- he left a party in Cleveland, Ohio, at 11:30 last
night, and they found his car this morning in the smokestack of a British
aircraft carrier in the Formosa Straits.'
  -- Grand Panjandrum's Special Award, 1985 Bulwer-Lytton
     bad fiction contest.

Now when we pipe output of fortune to cowsay :

sumit@teardrop:~$ fortune | cowsay
 ______________________________________
/ You will remember something that you \
\ should not have forgotten.           /
 --------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

This looks fancy. Now add this to bottom line of you ~/bash.bashrc file. If this file is absent, then create one in your home folder. Every time you run terminal, you will get a cow with fortune for that run.

Check this youtube video for demo.