# Thread: How did you all become so good at encryption!

1. ## How did you all become so good at encryption!

Hi,

I looked through some source code of encryption programs written for the contest. I was sad that i found difficulty in understanding them. I just want to ask to those all who participated, or anyone really, what books have you got or read, or any courses you undertook, that taught u about encryption....etc

Bye

2. I just read a few web pages... there are plenty of them dedicated to encryption.

3. Well the encryption you saw.. That were submited by the contestants including me are not complex.. None of us have written an advanced algorithm likes DES, Bowl Fish etc etc. We have just written XOR, vigenere and other simple encryption algorithm which is very easy to code if you understand it...

4. "Encryption" does not necessarily imply the use of complex algorithms to decode one's data.

It could be something as simple as, say, replacing all the 256 characters by others in a file... e.g.

replace all

a -> j
g -> k
e -> p
....

so that no one can understand the contents of that particular file....

if you're willing to learn encrytion, start with a similar program.

i.e.

1. Read a file character by character.
2. Replace each character by it's equivalent in a pre-defined table.
3. Write the equivalent of each character of the original file into the output file.

Similarly, you can proceed onto more complex algorithms, for example

1. get the current time
2. if the time is "odd" use one table, if it is "even" use another
3. write a character 'o' or 'e' into the output file, to indicate the correct table to be used by the decryption program.
4. follow the pattern of the first algorithm...

5. Encryption is one of the most fascinating subjects to me (and probably to many more). And with a little knowledge of bit operations, you can come out with your own bits based encryption algorithm. One of the simplest way of doing this is as Zeeshan said (though not bits manipulation). There are many more simple ones like, reverse every bit of a byte on a file stream.

Ex: 10 when reversed becomes 245
00001010 --> 11110101

6. I suppose simply reversing every bit is too easy to crack? Well i am not 'entirely' new to encryption i've written a small basic xor encryption program. But i am just not sure where to go on from here.

7. For encryption based on a key you can do this

Take the first char of the key and xor it with the first char of the message... And after the key is exhausted again start from the first char of the key.. A better idea would be to create a array table eg

int array[5][5]
{
a b c d e f
b c d e f a
c d e f a b
d e f a b c
e f a b c d
f a b c d e
}

You will have to make this aray till Z if you want to be able to encrypt all the englich alphabets in English..

Now consider that the message to be encrypted is

"fbcf abc dfe"

If the user gives a key as "dcaf"

now to encrypt this write an algorith
eg since the first key char is "d" go to the row that has the begin letter as "d" and since the message to be encrypted has the first char "f" go to the column that has the begining lletter as "f". Now see which char intersects between the row and the column .. It is "c".. So continue this.. Encrypt the 2nd char with 2nd char of the key as aboe.. And the result will be

"cdce ddccce"

To decrypt this.. You will have to follow the same procedure..
And you get back the original message.. here the resultant encrypted text is based on the key given.. You can further strengthen it by encrypting it twice with the same password and other simple tricks.. THis is how my encryption program which i submited for the contest works.. TO generate the table i used a for loop and generated the ASCII values and used this to encrypt and decrypt text and symbols..

8. Yep thnx i understand your algorithm now. I guess it's really up to your imagination...

Popular pages Recent additions