Posts

Showing posts with the label Caeser Cipher

Caesar Cipher (Cracking Caesar Cipher with the Brute-Force Technique) - Part II

Image
In Part I , I have written code to encrypt the plain text for demonstration purpose . In this article we will use Brute Force technique to decrypt the encrypted message. Note: please make sure to read articles  Brute force and Caesar Cipher  before this article. Above code produce below  result, the above code took 17 iteration  to get the actual message.

Caesar Cipher Source Code - Part I

Image
The Caesar cipher is one of the earliest known and simplest ciphers; Created and used in 44 BC by Julius Caesar. It is a type of substitution cipher in which each letter in the plain text is 'shifted' with certain number of places in the alphabet. For example, if we right shift the alphabets by 3 char then we get the below text; So now if we encrypt the message with above "TEST MESSAGE" will show below result The encryption can be represented Mathematical, by first transforming the letters into numbers, like  A = 0, B = 1,…, Z = 25. To represent the Caesar Cipher encryption function, e(x), where x is the character we are encrypting, as: E(X) = (X+K)  (mod 26)  Where K represents key used to shift the letters in alphabets. for decryption we can use below equation  E(X) = (X-K)  (mod 26) I have written the below code which accept user input and right shift the alphabets by 9 char: Result produce by of abov

Basic of Cryptography - Part I

Cryptograph means secret writing, in order to make information secret we use cipher, an algorithm that converts plain text to cipher-text. Cipher has been used long before computer existance. In 44 BC  Julius Caesar uses the technique now called Caeser Cipher  to send message. He used to shfit the letter by 3 character.  Another great example from history, Nazis Enigma Machine used during war to translate message. Data Encryption Standard (DES) is the first algorithm written for Cryptography in early 19th century. A process of making text secret is called Encryption and the reverse process is called Decryption. So far the Cryptography technique we mentioned  above relies on keys known by sender and receiver. Though manual sharing key is not good idea, solutions is to automate exchange of keys. We can do this by using one way functions , to understand one way function here is the Good example of one way function is Diffie-Hellman key exchange .  There are two types