User:Ishan mehta/Sandbox

Summary
This article describes an algorithm to encrypt data using a N-bye symmetric key. It is not based on any well-known algorithms, but is a completely new approach to encrypt data.

Initialization
First we need to take a constant:

"" This constant can be different for different implementations.

We also need to take a few variables:

"" _encLevel and _encKey can have any value set by implementation, or in case of a library, a public setter can also be provided so its value can be changed at runtime.

_encLevel defines how many times a string will be encrypted over and over again. More value of _encLevel means it would be more complicated to decrypt the encrypted string without the key. Whenever value of the _encKey is changed, the _encKeyTotal should be recalculated as per the following logic:

"" A typical value of the Character.MAX_VALUE would be 65535 (supporting unicode characters).

Encryption
is a parameter passed to the encrypt subroutine.

Now, initialize a few variables,

"" Now, run a loop for _encLevel times. This will keep on encrypting the string (first time the input string and then the encrypted string) number of times to make it more and more secure. ""

Decryption
Decryption also works in the similar way. It processes the encrypted string in the reverse order (i.e. from last character to the first character).

Consider  as the subroutine parameter having previously encrypted string using the same key and same encryption level.

""

Performance
The algorithm is pretty optimized. The performance depends on the length of the string to be encrypted and the encryption level. The key also makes a difference, but not much.

Java implementation of this algorithm and taking into consideration the string "My name is Ishan" and with low encryption levels (upto 2000) it hardly takes 10 milliseconds. With encryption level of 100,000 also it takes only 70 milliseconds to encrypt / decrypt. Normally, decryption takes slightly more time as compared to encryption. This was tested on a Virtual Machine installed on a Core2Duo E4500 CPU @ 2.2GHz with 2 GB RAM - Windows Vista Home Basic (allocated 1GB to the guest OS - Windows XP SP2).

Examples
Following are some example encryptions generated using this algorithm:

Example 1
Source String = "My name is Ishan"

Key = "Ishan"

Encryption Level = 10

Encrypted String (series of unicode hex characters) = 0x68db 0x4bc5 0x87f6 0x9c15 0xf8ef 0xec69 0xfe85 0x5a58 0x6293 0x236b 0x1707 0x9ecd 0x9be7 0xddfa 0x8549 0x1aa2

Example 2
Source String = "My name is Ishan"

Key = "Ishan"

Encryption Level = 15

Encrypted String (series of unicode hex characters) = 0xf379 0x5af5 0xafec 0x8d9d 0x72e1 0xafe0 0x68bf 0xf087 0x2f05 0xc696 0x2c81 0x4be2 0x222b 0xa061 0x32d3 0xdcff

Just by changing the encryption level from 10 to 15 makes the encrypted string totally different.

Example 3
Source String = "My name is Ishan"

Key = "Ishan1"

Encryption Level = 15

Encrypted String (series of unicode hex characters) = 0x32ec 0x0a33 0xece9 0x0310 0xdabc 0x3bd6 0x32a7 0xf438 0x7992 0x6bb1 0x29b0 0xb7e9 0x139c 0x3e3d 0xdf86 0x791c

Just by adding a single character at the end of the key, but keeping the encryption level the same also makes a huge difference in the final encrypted string.

This makes this algorithm highly difficult to break.

Example 4
Source String = "My name is Ishan"

Key = "Ishan1"

Encryption Level = 100000

Encrypted String (series of unicode hex characters) = 0xea92 0xa551 0xc88a 0xecb3 0x4cdb 0xb22e 0xf453 0xf322 0xce4f 0xdd75 0x7c64 0x648d 0xd7ec 0x2243 0x54a 0xa88b

Time taken to encrypt = approx 70 mSec

Time taken to decrypt = approx 70 mSec

Some stuff for Crackers
Here are some example encrypted strings. Try to extract the original string out of this. The strings are provided in the form of series of unicode hex characters.

Example 1
""

Example 2
""

--Ishan Mehta (talk) 02:57, 24 September 2008 (UTC)