Sign in to follow this  
Followers 0
LordBlackout

Enygma Tool v.1.0

4 posts in this topic

Hi,

here is Enygma Tool v.1.0, a simple text encrypter.

I'm italian, so labels are in italian, but is very simple and it's easy to understand how it works :

In the first 5 input boxes you must put an < or = to 26 integer.

The same with the 6th.

In the first editbox you must put the text to elaborate and in the second editbox you will see the result of the elaboration (encryption/decryption).

To encrypt a text, the program will make jumps on the alphabet..

Example:

In the first 5 input box we put: 3-4-5-6-7

In the 6th input box we put 2.

So the program will jump the first 2 letters (2 is from 6th input box) 3 times forward on the alphabet,

the second 2 letters, 4 times, the third 2 letters, 5 times, etc.

When the program reach the 5th input box (in this case the one that contains 7), it will restart from the first (in this case 3).

For example, in the case shown, the string "hello", encrypted will be "khppt".

It's good beacuse a letter in a text will be encrypted every time with a different letter, so the analysis of the frequencies of letters will be unuseful to decrypt the text :blink:

Sorry for my english, I hope you understand me:)

Here is the .exe --> http://ubuntuone.com/p/9d1/

And here the code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <String.au3>
#include <Array.au3>

#Region ### START Koda GUI section ###
$Form1 = GUICreate("~ Enygma Tool ~ v.1.0", 426, 658, 494, 37)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("Enygma Tool", 22, 16, 385, 76)
GUICtrlSetFont(-1, 48, 400, 0, "Odessa LET")
GUICtrlSetColor(-1, 0x00FF00)
$Label2 = GUICtrlCreateLabel("Offsets:", 32, 142, 72, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Candara")
GUICtrlSetColor(-1, 0x00FF00)
$Label3 = GUICtrlCreateLabel("Testo da elaborare:", 32, 253, 186, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Candara")
GUICtrlSetColor(-1, 0x00FF00)
$Label4 = GUICtrlCreateLabel("Testo elaborato:", 32, 429, 157, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Candara")
GUICtrlSetColor(-1, 0x00FF00)
$Label5 = GUICtrlCreateLabel("Cambio offset ogni", 32, 189, 165, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Candara")
GUICtrlSetColor(-1, 0x00FF00)
$Label6 = GUICtrlCreateLabel("caratteri", 215, 189, 73, 27)
GUICtrlSetFont(-1, 14, 400, 0, "Candara")
GUICtrlSetColor(-1, 0x00FF00)
$Label8 = GUICtrlCreateLabel("by Lord Blackout", 155, 95, 123, 23)
GUICtrlSetFont(-1, 12, 400, 0, "Candara")
GUICtrlSetColor(-1, 0x00FF00)
$Input1 = GUICtrlCreateInput("", 104, 144, 25, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Input2 = GUICtrlCreateInput("", 136, 144, 25, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Input3 = GUICtrlCreateInput("", 168, 144, 25, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Input4 = GUICtrlCreateInput("", 200, 144, 25, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Input5 = GUICtrlCreateInput("", 232, 144, 25, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Input6 = GUICtrlCreateInput("", 186, 190, 25, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
$Edit1 = GUICtrlCreateEdit("", 32, 280, 361, 97)
GUICtrlSetData(-1, "")
$Edit2 = GUICtrlCreateEdit("", 32, 456, 361, 97, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("CRIPTA", 80, 576, 113, 33)
GUICtrlSetFont(-1, 16, 400, 0, "Candara")
$Button2 = GUICtrlCreateButton("RESET", 176, 624, 65, 17)
GUICtrlSetFont(-1, 10, 800, 0, "Candara")
$Button3 = GUICtrlCreateButton("INCOLLA", 312, 258, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "Candara")
$Button4 = GUICtrlCreateButton("COPIA", 312, 434, 81, 17)
GUICtrlSetFont(-1, 10, 800, 0, "Candara")
$Button5 = GUICtrlCreateButton("DECRIPTA", 225, 576, 121, 33)
GUICtrlSetFont(-1, 16, 400, 0, "Candara")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


Global $Offsets[6]

While 1
$nMsg = GUIGetMsg()
    Select 
        
        Case $nMsg = $Button1
            $Input = GUICtrlRead ($Edit1)
            $Offsets[1] = GUICtrlRead ($Input1)
            $Offsets[2] = GUICtrlRead ($Input2)
            $Offsets[3] = GUICtrlRead ($Input3)
            $Offsets[4] = GUICtrlRead ($Input4)
            $Offsets[5] = GUICtrlRead ($Input5)
            $C_Offset = GUICtrlRead ($Input6)
            If $Input = "" Then
                MsgBox (16, "Errore", "Non è stato fornito alcun testo da elaborare.")
                ContinueCase
            EndIf
            For $x = 1 To 5 Step 1
                If $Offsets[$x] > 26 Or $Offsets[$x] = "" Then
                    MsgBox (16, "Errore", "Ogni offset deve essere un numero minore o uguale a 26.")
                    ContinueCase
                EndIf
            Next
            If $C_Offset > 26 Or $C_Offset = "" Then
                MsgBox (16, "Errore", "Il cambio offset deve essere un numero minore o uguale a 26.")
                ContinueCase
            EndIf
            $Offset = $Offsets[1]
            $Array = StringSplit ($Input, "")
            $b = $C_Offset
            $c = 1
            For $a = 1 To $Array[0] Step 1
                $ASCIIold = Asc ($Array[$a])
                $ASCIInew = $ASCIIold + $Offset
                $Carattere = Chr ($ASCIInew)
                $Array[$a] = $Carattere
                If $a = $b Then
                    $b = $b + $C_Offset
                    $c = $c + 1
                    If $c = 6 Then $c = 1
                    $Offset = $Offsets[$c]
                EndIf
            Next
            $Ouput = _StringToHex(_ArrayToString ($Array, "", 1, $Array[0]))
            GUICtrlSetData ($Edit2, $Ouput)
            
        Case $nMsg = "ErroreCrypt"
            Sleep (1)
            
            
        Case $nMsg = $Button2
            GUICtrlSetData ($Input1, "")
            GUICtrlSetData ($Input2, "")
            GUICtrlSetData ($Input3, "")
            GUICtrlSetData ($Input4, "")
            GUICtrlSetData ($Input5, "")
            GUICtrlSetData ($Input6, "")
            GUICtrlSetData ($Edit1, "")
            GUICtrlSetData ($Edit2, "")
            
        Case $nMsg = $Button3
            GUICtrlSetData ($Edit1, ClipGet())
            
        
        Case $nMsg = $Button4
            ClipPut(GUICtrlRead ($Edit2))
            
        Case $nMsg = $Button5
            $Input = _HexToString(GUICtrlRead ($Edit1))
            $Offsets[1] = GUICtrlRead ($Input1)
            $Offsets[2] = GUICtrlRead ($Input2)
            $Offsets[3] = GUICtrlRead ($Input3)
            $Offsets[4] = GUICtrlRead ($Input4)
            $Offsets[5] = GUICtrlRead ($Input5)
            $C_Offset = GUICtrlRead ($Input6)
            If $Input = "" Then
                MsgBox (16, "Errore", "Non è stato fornito alcun testo da elaborare.")
                ContinueCase
            EndIf
            For $x = 1 To 5 Step 1
                If $Offsets[$x] > 26 Or $Offsets[$x] = "" Then
                    MsgBox (16, "Errore", "Ogni offset deve essere un numero minore o uguale a 26.")
                    ContinueCase
                EndIf
            Next
            If $C_Offset > 26 Or $C_Offset = "" Then
                MsgBox (16, "Errore", "Il cambio offset deve essere un numero minore o uguale a 26.")
                ContinueCase
            EndIf
            $Offset = $Offsets[1]
            $Array = StringSplit ($Input, "")
            $b = $C_Offset
            $c = 1
            For $a = 1 To $Array[0] Step 1
                $ASCIIold = Asc ($Array[$a])
                $ASCIInew = $ASCIIold - $Offset
                $Carattere = Chr ($ASCIInew)
                $Array[$a] = $Carattere
                If $a = $b Then
                    $b = $b + $C_Offset
                    $c = $c + 1
                    If $c = 6 Then $c = 1
                    $Offset = $Offsets[$c]
                EndIf
            Next
            $Ouput = _ArrayToString ($Array, "", 1, $Array[0])
            GUICtrlSetData ($Edit2, $Ouput)
    
        Case $nMsg = "ErroreDecrypt"
            Sleep (1)
    
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
            
    EndSelect
    Sleep (25)  
WEnd

P.S.

Some times, a jumping forward a letter like the Z (the last of the alphabet) the result may be a very strange symbol or a white space.. sometimes copying this things on a program like messenger they will be lost and the message compromised. To avoid this, the encrypted message is converted to a HEX string ;)

Any suggestion is very appreciated :P

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Knowing the length of the password is giving away rather a lot of information. A six letter password is simply too short. Whether the password contains numbers or letters makes no difference. I also don't understand why you limit the leaps to 26. That seems unecessary. The same set of six five leaps repeat in a loop. That is a predictable pattern. It's good you got it to work both ways, but the design needs to be more tricky.

Edited by czardas

Share this post


Link to post
Share on other sites

Yes, you're right, 6 digit password is too short.. in the next version I'll make a variable number of offsets.

The limit to 26 is made to avoid getting out the ascii code.. but I think that I can put a higher one without problems.. I have to try the higher number possibile that don't return errors..

And for the loop.. any idea to make the pattern less predictable?

Thanks for the reply ^^

Share this post


Link to post
Share on other sites

There are many interesting articles about cryptography on wikipedia. I think it is a good idea to read about the old methods and learn why some of them are weak. Then you will have a deeper understanding of the subject. It's a long read, but very interesting. I have read some of this stuff, but not all, of it. This page might be a good place to start:

http://en.wikipedia.org/wiki/Topics_in_cryptography

Look around the internet to find more information about the subject, and try to imagine how you would go about cracking your own, or somebody else's, encryption.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0