• Cyrus

Cryptography: An introduction to ciphers and brute force hacking

Important terms to know:

Cryptography - The study of securing data.

Encrypting - Concealing data

Decrypting - Revealing data

Plaintext - Unencrypted data

Ciphertext - Encrypted data

Brute Force - A rather trial and error method used to obtain information. An example of this would be using a number of different potential passwords to hack into someone's Instagram account. If packet sniffing is picking a lock to a door to get to the other side, then brute force would be like deciding you don't like doors and just blowing it up.

Keys - Something used to transform plain text into cipher text or the other way around. There are different types of keys, which I go over later.

Keep in mind, I'm no expert. All of this is explained as I understand it, so hopefully I can make it understandable.

In cryptography, ciphers are algorithms for encrypting or decrypting information. A super simple and well known cipher would be the Caesar Cipher.

In the Caesar Cipher, each plaintext letter is shifted a number of places down the alphabet. For example, in a shift of 5 the letter A would be replaced by F and B would be replaced by G and so on. Here's a practical example.

Ciphertext: vgejpqrjavg ku vjg dguv vgej dnqi

The ciphertext is currently unintelligible. There's two hypothetical ways to decode this. The first one is just using a key. The key I used for this was a shift of 2. It's a bit tedious but you can decode this now.

V shifted by 2 is T, G is E shifted by two, and so on.

I mentioned a second one. You could hypothetically just crack it by brute force. The way you'd do this is systematically run the ciphertext through a list of keys and see what works.

eg: running the ciphertext through a key of one, then two, then three, and so on.

This works, but even for an encryption algorithm this easy to crack it can be tedious, especially for larger keys because the process is ran through more ciphers.

The problem with brute force hacking is that it's dependent on processor and/or GPU power. Slower processors won't be able to run keys by ciphertext as quickly as faster processors. The thing is, these components are getting faster and faster. This is why encryption methods are always changing. This is out of the scope of this post though. I just wanted to introduce these ideas.

This was originally going to be a post about ciphers and encryption in general, but I think that will be too overwhelming. I'll make more blog posts later.

I made a simple implementation of the Caesar Cipher in java. It can encode plaintext and brute force ciphertext. Here's a link to it on my github page. I highly encourage you to take a look at this and mess around with it.