Home > Tips > Encryption and Decryption > Decryption Logic
Decryption Logic
Decryption logics, finding and cracking the private secret key, XOR key finder VB6, VB.Net and C# source code
Decryption Logics - How to crack the private secret code?
You have the encrypted chipper text and
you want to decrypt the text. however you don't know the
secret key by which it encrypted. There is no
predefined formula for find the secret key. It is an art
and normally known as cryptography or reverse engineering.
You can
follow some basic guide line to find the secret key.
- Try to find the pattern of repetitive character.
- If it is a database field try with numeric field, as the range will be (0-9)
- Try with each key and find the output in most readable format.
- If it is a long text or paragraph most probably it encrypted
with XOR Encryption because it is fast to
execute.
- If you have the Encryption Program try to create more chipper
text with same plain text, and if you have same
identical output each
time then try to find the encryption
pattern.
Time required for find any secret key depend upon the secret
key length and algorithm used. The actual time depends on
the key length other than the algorithm used. For finding
the secret key you need four basic thing Time, Logics,
Patients and Motivation. I heard one probe "Locks are not
made for Thief" it means locks are made for normal and
honest people not for the thief. It is very much true in the
cryptography world. Encrypted or chipper text are for normal
and honest person and not for the professional and motivated
hacker.
Following example I will show you how to find a secret key
for XOR Encrypted text. It is a very basic example and real
world decryption process totally different thing altogether.
I also provide complete source code for Automatic Secret Key
finder for XOR Encryption. You can download the project file
from sample code section.
Finding the Secret Key or Private Key for XOR Encryption
I have the following text and I want to know the Secret key
by which it originally encrypted.
íÒŽ€áÔÁÎÕ€íÁÉÔÙŒ€íãóäŽîåô
First I have create a Readable text stream and stored it
into a string variable.
Dim
StrPT As
String
StrPT =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-
abcdefghijklmnopqrstuvwxyz"
Now I will XOR Each character of Encrypted text with a code range from
1 to 255 and stored it into separate variable probably an
array and compare each decrypted string with our readable
text streams and give a rank for each decrypted text.
Declare an Array to hold all Secret key, Decrypted Text and
Rank.
Dim
DecrArray(255, 3) As String
Now XOR Each character of the Encrypted text
and create decrypted text and compare it with the Readable
text stream and give the rank and stored it into the array.
Dim StrPT
As String
StrPT =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890,.-
abcdefghijklmnopqrstuvwxyz"
Dim StrET
As String
StrET =
"íÒŽ€áÔÁÎÕ€íÁÉÔÙŒ€íãóäŽîåô"
Dim
DecrArray(255, 3) As String
Dim i
As Integer
For i = 1
To 255
Dim TempDE
As String
TempDE = XORCipher(StrET, i)
'>>> compare to
ReadableText
Dim j
As Integer
Dim r
As Integer
r = 0
For j = 1
To TempDE.Length
If
InStr(StrPT, Mid(TempDE, j, 1)) > 0 Then
r = r + 1
End If
Next
'>>> decrypted
text
DecrArray(i - 1, 0) = TempDE
'>>> XOR/ Secret Key
DecrArray(i - 1, 1) = i
'>>> rank
DecrArray(i - 1, 2) = r
Debug.WriteLine(DecrArray(i - 1, 0) & vbTab &
vbTab
& DecrArray(i
- 1, 1) & vbTab & vbTab & DecrArray(i - 1, 2))
Next
If you run the program it will display following text in
your debug window, Now you need to sort the array by rank in
descending order to get Probable plain text. You can see by
naked eye what is the decrypted text in this case and you
also found the secret key that is 160.
Decrypted Text Secret
Code Rank
ìÓàÕÀÏÔìÀÈÕØìâòåïäõ 1 0
ïÐŒ‚ãÖÃÌׂïÃËÖÛŽ‚ïáñæŒìçö 2 0
îуâ×ÂÍÖƒîÂÊ×Úƒîàðçíæ÷ 3 0
éÖŠ„åÐÅÊÑ„éÅÍÐ݈„éç÷àŠêáð 4 0
è׋…äÑÄËÐ…èÄÌÑ܉…èæöá‹ëàñ 5 0
ëÔˆ†çÒÇÈÓ†ëÇÏÒߊ†ëåõâˆèãò 6 0
……………………… ………………………………………………………………………………………………………
sL__J_PK_s_WJG__s}mz_p{j 158 14
rM__~K^QJ_r^VKF__r|l{_qzk 159 14
Mr. Atanu Maity, MCSD.NET 160 22
Ls/!@u`ot!L`hux-!LBRE/ODU 161 17
Op,"Cvclw"Ockv{."OAQF,LGV 162 21
Nq-#Bwbmv#Nbjwz/#N@PG-MFW 163 20
You can find complete source code for the above algorithm in
source code section. Click Here to download the XOR
Decryption and Secret Code finder in VB 6 and Visual Basic
.NET.
How to Create Better Encryption Algorithm.
It is impossible to create secret code that can not be
break. However you can combine more than one algorithm to
make the encrypted text which is near to impossible to
break.
Home > Tips > Encryption and Decryption > Decryption Logic