Objectives in making this thread:- To define the meaning of cipher and its usage
- To enumerate different types of cipher used in different era and how they work
- To value the importance of cipher in technology
- To assess also my knowledge in cipher and codes, I know only the basics and I always look for opinion and insights
References:
Have you ever seen a sci-fi movie about treasures? It seems like the movie will not end without codes that the characters are breaking. The codes that they cracked give a way for them to a new task or in treasures. Do you want to learn also how to crack a cipher/codes? Then read this thread.
That's really how a cipher works. It is like a code but not exactly that made to hide a file or thing that might be an important to a certain person.
Do you want to learn also how to crack a cipher/codes? Then read this thread.
Meaning of cipher:In cryptography, a cipher (or cypher) is an algorithm for performing encryption or decryption—a series of well-defined steps that can be followed as a procedure. An alternative, less common term is encipherment. To encipher or encode is to convert information into cipher or code. In common parlance, "cipher" is synonymous with "code", as they are both a set of steps that encrypt a message; however, the concepts are distinct in cryptography, especially classical cryptography.
Meaning to say it is a series of undefined symbols/characters/numbers that cannot be read by human or even computer without proper mechanism to decrypt it.
Example: If I will give you a number like this [98445#50712663] Probably you wouldn't care of it because it is just a set of numbers with a sign number enclosed by parenthesis. But if I will give a conversion.
A=5
D=3
E=8
G=2
I=7
L=4
N=9
0=6
S=1
R=0
Y=#
What do you read now?
(No, I am not good) I'm awesome! Kidding aside, so it gives you an answer of [Nellayarisgood].
The difference of cipher in code
Codes generally substitute different length strings of character in the output, while ciphers generally substitute the same number of characters as are input.
In simple words,
When we talk about codes, length doesn't matter.
Sample of code [2X2+3x4+5-1] wherein, (2X2 = O, 3X4 = W, 5-1=L). When you decrypt it, it shows the word [OWL].
While cipher give the same number when encrypt a text. Like this, [98445#50712663] it has 14 number and symbol (without the parenthesis). And of course, it read as [NELLAYARISGOOD] which also has 14 characters.
Now you know already the cipher and it's difference from code. Let us talk about its type.
Types of CipherIt is consists of a rod and parchment. This cipher was used by ancient Greeks (Spartans) in war. It might be a signal or a strategy used in order for the enemies not easily determined their plans.
How it works?
Just simple round the parchment in the rod. The diameter and length of the rod must be equal to the length of parchment and the distances of the letters.
Since I can't use parchment and rod, I improvised my own.
I used a piece of cloth and candle just to show the encrypted message.
How do we decrypt the Scytale Cipher?
Just roll the parchment/piece of cloth in the rod(Candle). And you will decrypt the message. Just like this:
So, from the encrypted message. We decrypted it by rolling the cloth in the candle. The message is [NELLA-YARIS-GOOD.]
By the name itself, it came from Julius Caesar (known as Dictator of Rome). Since he was a dictator and a conqueror. He made cipher to organize attacks and made it as a secret signal/communication with his warriors. It is also called as caesar shift cipher, most popular and simplest cipher in the world.
How it works?
You need two sets of alphabetic letters from A-Z. If you have already, by shifting(any number you want) on other line of alphabetical letters, you are creating the cipher text.
Example:
In this example, I am using 2 shifting. So if you can see, letter A=C, B=D, C=E and so on. The upper letters will be your plaintext and the lower letter will be your ciphertext. In that case, if I am going to encrypt the word [NELLAYAR], the cipher text would be [PGNNCACT]. That is how will you encrypt your data. To decrypt it, reverse the pattern.
How will you crack a caesar cipher? Just try 26 shifts and probably, there is one that is correct.
Just like with Caesar, this cipher came from ancient historian and scholar of Greeks named as Polybius. This was invented to make signals for attacking and transmit coded information by which it cannot be determined easily. It is a method of fractioning or dividing the alphabet by using a small set of numbers. Polybius square is also known as polybius checkerboard.
How it works?
You only need to have this checkerboard. This is partitioned into 6 rows and 6 columns.
On the first column and row, you will see the numbers from 1-5 and inside of it is the alphabetical letters.
In Greek Alphabet: In Latin Alphabet:As you can see, there are only 24 alphabetical letters in greek. So, it was not a problem with Polybius and to the greeks to encode or decode this cipher. Unlike with latin/english alphabet, it consists of 26 alphabetical letters. So, there is a box that has 2 letters [I/J]. And [C/K] is sometimes read an alternative letters.
How to encrypt? You just need to locate the coordinates of the letters. You can read first the vertical numbers, next is the horizontal numbers in encrypting the message.
Example, [NELLAYAR] it will drive to the coordinates of [33 15 31 31 11 54 11 42]
See, it is really simple. If you want to decrypt that cipher. You only need to have the checkerboard or atleast memorized the location and position of the numbers and letters.
It derived from Hebrew Alphabet [
Aleph-
Tav-
Beth-
Shin] meaning the first(aleph), last(Tav), second(Beth), second to the last(Shin). It is a particular type of
monoalphabetical cipher formed by taking its alphabet and mapping its reversed. It is also a special case of affine cipher.
How it works?
You just need to write down the 26 alphabetical letters in order and reverse it. You only need two columns. Like this:
So as you can see, A=Z, B=Y and so on. So if I encrypt the word [NELLAYAR], it shows like this [MVOOZBZI].
Basic? Let's move on to the next.
The affine is a type of monoalphabetic substitution cipher, where each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted back to a letter. The formula used means that each letter encrypts to one other letter, and back again, meaning the cipher is essentially a standard substitution cipher with a rule governing which letter goes to which. As such, it has the weaknesses of all substitution ciphers. Each letter is enciphered with the function (ax + b) mod 26, where b is the magnitude of the shift.
In this cipher, there is a little bit mathematical equation to be solved in order to encrypt the data and decrypt as well. You need also to have a background in modulo.
In basic, modulo is the
remainder of the divisor and dividend. Example 14÷3=4 and it's remainder is 2. So the modulo is 2. But you can check out this
thread if you want to deep dug the modulo.
How to encrypt? This is hard guys, so pay attention with every step. I also wrote it so that, I can show you that I try every cipher I presented.
The first row is the alphabetical letters where you can select your plaintext and the second row is the corresponding number of the letters, like A=0.
In above picture, you will see the plaintext. You can make it in your own. But in this case, I put the word [NELLAYAR]. Below of the plaintext are the numbers that correspond every letter. I got the conversion from the first image.
How do I get that? Using the formula, [Ex = ( Ax + B ) mod M]. Given an example params:
A = 5(coprime with 26)
B = 8(magnitude of shifting)
M = 26(Alphabet Length)
E = encryption
Substitute the given (you can make your own given as long as (A is coprime with M).
Ex = ( 5x + 8 ) mod 26
Next step, you need to look at the corresponding number in your plaintext and solve the equation properly. After, solve for the (x).
Since N=13 then,
Ex = ( 5(13) + 8 ) mod 26
Ex = ( 65 + 8 ) mod 26
Ex = 73 mod 26
Ex = 21
How did I got the 21? 73/26=2 remainder(r) 21: 26*2=52, (73-52=21)
Since modulo takes the remainder. I have also come up to my own mini postulate.
If M>N = the value of "N" will remain
If M
Proceed to the next letter and it's corresponding number.
Since E=4 then,
Ex = ( 5(4) + 8 ) mod 26
Ex = ( 20 + 8 ) mod 26
Ex = 28 mod 26
Ex = 2
How did I got the 2? 28/26=1 remainder(r) 2: 26*1=26, (28-26=2)
Proceed to the next letter until you get the answers by substituting the given in equation and manipulating the formula.
So here is the complete table:
You can see how the plaintext turn into numbers using only a governing equation. From NELLAYAR to [21 2 11 11 8 24 8 15].
Next step is to convert the following numbers into ciphertext [21 2 11 11 8 24 8 15] which drives us to the word
[VCLLIYIP].
How decipher/crack the affine cipher?
1. We need to know the governing equation. In that case, Ex = ( 5x + 8 ) mod 26.
2. We should use the multiplicative inverse to inverse the equation. In this case, D(y) = 21 ( y - 8 ) mod 26 is the formula to decipher.
Hence we have V=21, substitute the given to the formula.
D(y) = 21 ( 21 - 8 ) mod 26
D(y) = 21 (13) mod 26
D(y) = 273 mod 26
D(y) = 13: 273/26= 10 r. 13
Proceed again to the next letter, C=2 then:
D(y) = 21 ( 2 - 8 ) mod 26
D(y) = 21 (-6) mod 26
D(y) = - 126 mod 26
D(y) = 4: - 126/26= - 4 r. - 22 (since it is negative, we are going to add it on 26) to make it positive: - 22+26=4
The complete table is below:
Proceed it until the last letter that you want to decipher. If you will continue to solve it, it will go back to the numbers [13 4 11 11 0 24 0 17]. Which if you convert it again to plaintext, it derives into [NELLAYAR].
CONFUSED about what is multiplicative inverse and modulo? Look at the reference for further info.
It was invented by, Blaise de Vigenère. Basically, the title of cipher came from his name. See, how meritocracy worked.
Most of the inventors/scholars/prodigies entitled their name with what they invented/discoveriesIt is also known as polyalphabetical cipher. The difference between monoalphabetical and polyalphabetical:
In monoalphabetical cipher - there is only 1 character that will be result to a same letter. Example, in the word NELLAYAR, there are 2 letter L, and if you encrypt that. It will give you only 1 character like L=M for the first appearance and L=M again for the second appearance.
While polyalphabetical cipher creates 2 or more various character. So, it is more secure than mono. Since it can't be reversed easily. Unlike with monk, you can easily predict the next appearance if you already cracked the letter.
How it works?
1. We have to know the list of conversion table. Similarly with affine cipher but it has a negative notation from - 26 to - 1 (eastward direction). [just always look in this conversion table].
2. In order to encrypt, we have to make our plaintext and our key.
Plaintext: NELLAYARISGOOD
Key: Bitcoin
To get the cipher text(CT), we have to list down the plaintext first for every element in table. And use the conversion in above table. We are going to list the key also as well as its corresponding number in conversion table. We need to fill the word [BITCOIN] until the last part of table. Look below:
Next, just add the converted numbers of the PT and key.
So for example N=13 and B=1, add them (13 + 1 = 14). E=4 and I=8, add them both (4 + 8 = 12) and proceed until the end of the table.
Next step to get the Cipher Text, we need to subtract the results from 26(it came from mod 26, the length of the alphabet or characters from A to Z). So here is the complete equation, CT= (PT + Key) mod 26). Let's say we will look for the CT(cipher text) of "N" and "B".
CT = (13 + 1) mod 26
CT = (14) mod 26
CT = 14
Next row,
CT = ( 4 + 8 ) mod 26
CT = (12) mod 26
CT = 12
As I have said before, if M(mod) is greater than N then the answer would remain.
26>14= 14
26>12= 12
And if M(mod) is less than N, you will take the remainder.
Sample:
26<30 = 1 r. 4
That's how modulo works.
Now we already completed the cipher text. See below:
We can get its converted letters again using the converted table.
How to decrypt vigenere cipher?
1. We need to have first the key and the cipher text. Simply, right down the Cipher Text(converted to numbers) and Key(converted to numbers) in table.
2. Next, subtract the key in Cipher Text. Use this formula: (CT - K) = PT
Example:
14 - 1 = PT
13 = PT
Note:
If you get a negative quantity in Cipher Text. Example your CT is -15, just take a look to the negative part on table and look the corresponding letter. So, - 15 is equal to "L".
[/list]
There are many types of cipher, but I want only to discuss some of it in order for your to read more about it. I will give you the links which you can read more and be your reference. Remember, learning doesn't always occur in four corners of the classroom. You should also be used the metacognition.
Conclusion:Having knowledge in ciphers and cryptography is good. You may know how hackers will easily intercept you when your password is too weak. But do not use it in wrong way.
If we notice, cryptography does not really built in our era. Before, hashes and codes had been made. There are already ciphers which eventually evolved and developed by cryptography. How it is connected in bitcoin? If you will read elliptical curve cryptography, you can see how our private keys convert into public keys. It is more secure than the ciphers that I have been dicussed because it is already using (modulator demodulator). If it we solve mathematically, there is no probability to decrypt it since it is irreversible. If you want to get deeper on that topic, I suggest you to click this
thread by webtricks.
I know that it is already a basic to others but I want some people here to get an interest behind cryptography. So that, we just don't look crypto as profits but we will learn it's technicalities. Just like cracking a code. Basically, it all started from ciphers using to encrypt messages to make a signal for attack or transmitting message anonymously. If you will say that it is not important nowadays, then I would say to you that we are using ciphers and codes in different areas. Just like when you are generating keys, inputting passwords, and so on. We just don't see but we are always deal with ciphers, codes and hashes. Imagine, hash is the reason why we can generate keys from private to public. I want to tackle more about hash but that is another story for another, "52 23 11 44 24 21".
I hope this help you guys! Btw, I hope I am in the right section to post this thread. I planned to put this in development and technical discussion but it seems like it is off-topic right there.
Anyway, just remember that knowledge is power and ignorance is vice. I am always open for comments.