# Cryptography, Can you brake the CODE?

Discussion in 'Tutorials' started by akshar, Jun 24, 2005.

Tags:
?

## Do you know what a digital signeture means?

100.0%
2. ### no

0 vote(s)
0.0%
Not open for further replies.
1. ### aksharNew Member

Joined:
May 2, 2005
Messages:
87
0
Trophy Points:
0
Cryptography

Cryptography is the study of different methods of encryption, decryption and cryptanalysis of data. Whenever any sensitive information is sent on internet we must think about it's safety. It should not fall in wrong hands hence it is not sent the way it is supposed to be sent. It is encrypted. I hope you know what is meant by encryption. Encryption involves changing the original data such that it looses it's original form and becomes unreadable. Only the person you wish to read the data can read it after decrypting it. That means the method of decryption is known only to you and him. You must have understood what is encryption and what is it's need. This tutorial is too big and you should understand some jargon to understand it properly.

Plaintext: The original data you want to send

Ciphertext: The encrypted data

Cipher: The method of encryption, encryption algorithm

Crypto-analysis: The method by which a crypto-analyst generates plaintext from ciphertext when nothing is known to him about plaintext or nature of cipher. Evidently it's a hackers job.

The most basic cipher would be a substitution cipher. In this cipher every character in plaintext is replaced by another corresponding character. e.g. Consider a message
On the full moon day.
Let us replace a by b, b by c, c by d,.....,z by a. Then we get
Po uif gvmm nppo ebz

This the encrypted text we get. What if somebody gives you such text and tells you to decrypt? It looks difficult but not so difficult also. Any substitution cipher is the simplest to break by analysing it. Do you know that e is the most appearing character in English language? Can you use this knowledge to find out what is replaced for e? Second most appearing letter is t. Find out what is placed for t. Then with 2 observations in hand try to understand the logic of cipher. Now the job is pretty simple. This trick may not work for small sentences but works fine for long sentences. This method of breaking a cipher is called cryptoanalysis. If you can't take so much of pain to your head you can do something called bruteforcing. In this method you try all the possible substitutions. So in above case you will have to write a program that will try all the possible permutations. You can find out which one is readable and that will be the answer. You will have to try 26! permutions to get any possibility of answer and a 2 Ghz PC will hardly take 5 secs. for it.

Substitution ciphers are rarely seen anywhere may be in newspaper puzzles or some detective novels. In todays world we have ciphers like md5 which are so complex that they are very difficult to understand forget about decrypting it. At the same time people have invented new methods of crypto-analysis like differential crypto-analysis. Understanding these real life algorithms is not a small boy's game. So I will tell you a few ciphers which are still rarely used. XORing is such cipher.

You can xor a character in the string with it's position in the string. Understood? NO!
From the darkness to a new world
xor F with 0
xor r with 1
.........
You can find such cipher in the first encryption challenge at Hackthissite.org

Try writing such ciphering and deciphering programs. How about bruteforcing.Can you write a program that will produce all permutations of a given set of characters?

What if you want to send an email which contains very sensitive information. There is something called symmetrical ciphers. In above examples algorithm used to encrypt and decrypt is same. That is say sine is used to encrypt a number then sine inverse was used to decrypt. But that is not so safe. Hence in un symmetrical algorithms a key is used. A key is same thing like a password but very long usually 128 bit key is considered as safest. This is hardwired or kept very very secrete. This key is used to encrypt a message and also to decrypt a message.
ciphertext=Cipher_function(key,plaintext)
This key is shared between sender and receiver. No third person should get this key. This key is first sent to the sender through a secure medium. Then you can send the receiver the ciphertext. Plaintext is obtained using the key.
plaintext=Decipher_function(key,ciphertext)
This is all about symmetrical encryption.

2. ### #/bin/shNew Member

Joined:
Apr 20, 2004
Messages:
213
0
Trophy Points:
0
Location:
42.65 N 73.76 W
3. ### sharkNew Member

Joined:
Jul 5, 2005
Messages:
10
0
Trophy Points:
0
I'll try. Wish luck.

4. ### abhishekkulkarniNew Member

Joined:
Aug 15, 2004
Messages:
182
0
Trophy Points:
0
Location:
Amche Pune
Dude please USE the search facility of the Forum.A thread with the same title has already been discussed before.

5. ### khattam_Fresh Stock Since 2005

Joined:
Feb 13, 2005
Messages:
1,015
5
Trophy Points:
0
Am I supposed to "break" the code or "brake" the code??

6. ### Maverick340New Member

Joined:
Mar 19, 2004
Messages:
635
0
Trophy Points:
0
Hey which ws this scrpit were u write 4 for a and 3 for e..It came in the magzine once..i frgt which issue...

7. ### Maverick340New Member

Joined:
Mar 19, 2004
Messages:
635
0
Trophy Points:
0
And Pleeze explain that XORing way of writing..i dint get what u were saying above...
in ref to the above post:
This is what i ws talking about

8. ### anomitNew Member

Joined:
Mar 30, 2005
Messages:
252
0
Trophy Points:
0
Location:
Kharagpur
Man, I am about to burst!!!!!!!!

That's no script, you can use your imagination to write up stuff. I wrote one for the user koolbluez and he still has it in his sig.

|< 0 0 | |3 | |_| e z

Like this.

And what has it got to do with this topic?

If you dunno LOGIC gates or binary notation, forget about understanding what XOR is all about.

9. ### Maverick340New Member

Joined:
Mar 19, 2004
Messages:
635
0
Trophy Points:
0
k...u cud post an article what LGIC gates and binary notation is all about

10. ### anomitNew Member

Joined:
Mar 30, 2005
Messages:
252
0
Trophy Points:
0
Location:
Kharagpur
I would very much like to post one but only if there are some other requests. Otherwise when I will post one, there will be some 4 or 5 replies out of which 2 will say "Source Please". If you don't get any response for ur work, you too will be put off.

Joined:
Mar 19, 2004
Messages:
635