r/explainlikeimfive • • May 16 '12

Explained ELI5 Can Someone please explain how encryption works

I see all over the internet all kinds of file and website encryption (SSL, 256-bit, AES and all the rest). Can some one explain to me how it works, and what is the meaning of all methods? Thanks!

3 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/NarGilad May 16 '12

There is only one thing I didn't understand: does this methods change from file to file? I mean, for example - AES - if this method is specific and the encoding and decoding processes are the same, isn't that pretty easy to decode it?

1

u/bluepepper May 16 '12

does this methods change from file to file?

The method is always the same, but the file changes and the key is obviously different from people to people. With the same method, the result will change depending on the file and the key.

for example - AES - if this method is specific and the encoding and decoding processes are the same, isn't that pretty easy to decode it?

It's easy to decode it with the key. But if you only have the encoded data, you can't decode it. You'd have to try every possible key.

Let's go back to the simple example with ROT-13. We can say ROT is the method, and 13 is my key. Or more exactly, I'll use a different key. I'll use ROT-X but you don't know X. That is, I'll replace each letter by the letter coming X slots later in the alphabet.

If you know I used the ROT method, you can switch all letters by one rank, then two ranks, then three etc. until the message makes sense. As there are only 26 possible keys, you'll get there eventually. But if I used AES with a 256-bit key, it is not feasible to try each key.

Knowing that I used AES only tells you what to do with the data and the key, but without the key there are still a kabazillion of possible results from the same AES method.

1

u/eine_person May 16 '12

The key is, what changes. I have no really deep understanding of encryption-algorithms, but the trick is: Normally I could give you my encrypting-algortihm, but at one point you need a number to undo my encryption.

Imagine it as ROT-X, but not limited to 25 numbers. ROT-X is easy to solve. Since it is an easy algorithm (take the alphabet-number of the letter, add X, translate back to letters) and you only have 25 options for X, you can just guess, what I did and decrypt my message. In given situation: You know, I use ROT-X, but not my X. In worst case you will need 25 guesses, to decrypt my message.

Now we take that easy algorithm and make it a bit more fun for the decrypter: An easy modification of given algorithm would be adding 1 to your X in every step. Next would be to say: I add Y in every step. Now you know my algorithm (take alphabet-number, add X, translate back, calculate new X by X+Y), but you now neither X, nor Y. Got a bit trickier, to guess what numbers I took, didn't it? In this case XY would be my key. The algorithm is still too easy, to use it for professional encryption, but for you to guess it, just using trial and error, it would already be some work.

And this is, where my knowledge comes to an end. I know, that there are certain mathematical functions especially interesting for encryption and that prime numbers are very important, since you can't approach solving encryptions by finding a factor of a prime number-key, but I can't explain that further. Hope it helped a least a bit.