Unbreakable encryption is possible. Welcome to One-time Pad or what also referred to as “the perfect cipher”. To be honest, it is comforting to know that it is possible to encrypt text conversations to the point where it is practically impossible to decrypt without having the correct key. While the previous two ciphers mentioned earlier (Caesar Cipher and Vigenere Cipher) provide a way to scramble text into “gibberish”, both can be easily decrypted using pattern matching without needing the original key.
Unlike previous crypto algorithms, Vernam uses random key composed of random numbers to encrypt text. It is a very simple, yet powerful algorithm as you will see shortly.
Continue reading “Vernam Cipher in Swift”
Here is another classic cipher in Swift. This time it’s Vigenere. Similar to the way Caesar cipher works, Vigenere cipher improves on a couple of things. If you can recall my previous article, Caesar cipher works by shifting each letter in the plaintext a certain number of places down the alphabet. Vigenere cipher tries to improve on that approach by utilizing the keyword to offset each plain text letter by the keyword letter. This, of course, requires the keyword to be of the same length as the plain text.
Continue reading “Vigenere Cipher in Swift”
If you are at all interested in encryption and its history, then you undoubtedly heard of Caesarian cipher. The Caesar cipher was developed and used by Julius Caesar to encrypt messages between him and his generals. The mechanics behind it is to encrypt plain text by shifting each letter in the plaintext a certain number of places down the alphabet. For example, we could shift alphabet down 3 letters so that A would become D, B would become C… A would become X, etc.
I should mention that Caesarian cipher is extremely easy to decrypt. Don’t use it to encrypt sensitive data. However, I would consider it an “additional step” to already secured information. For example, when storing access token in keychain, we could encrypt it using Caesarian cipher to provide an additional layer of security. After all, it is possible to get information stored in a keychain especially if you know / get a hold of / a Mac password (this assumes keychain being synched).
Continue reading “Caesar Cipher in Swift”