Jump to content

New ABC Encryption 2.0!


datkewlguy
 Share

Recommended Posts

I am very excited about this. After countless hours of work between myself, erifash, and kevin, we have finally come up with this. The code is posted below, but first I'd like to explain how it works. If you have seen the last version, it is similiar, however, this is much better.

First and biggest thing we have changed is how it encrypts/decrypts the text. The last methods were kind of bizarre, however this is much better. It takes the square root of the string length and rounds that number. That number is how many times it encrypts it with the two-part algorithm. For instance, if you were to type in the leter 'a' it would return 'b'. However, if you would type in 'aaaaaaaaaa' your result would be 'dddddddddd'. In addition to letter 'shifting' it scrambles the order x amt of times, this is also based off the number generated.

While this is great, it is fairly slow, if people could come up with suggestions on how to speed it up [dramatically] that would be greatly appreciated. At the moment, this program is really aimed towards fairly small text, as any more will take longer.

#NoTrayIcon
#include <GUIConstants.au3>
#include <String.au3>

$win = "CyberText - 3.1.0.14" 

If @OSType <> "WIN32_NT" Then
    $msg = MsgBox(4, "Error, may not function with this OS", $win & " was designed for Windows XP, your Operating system may not support it." & @CRLF & "Continue running anyways?" )
If $msg = 7 Then Exit
    endif

Opt ("GUIResizeMode", 8)
$w = 300
$h = 220
$l = (@DesktopWidth - $w) / 2
$t = (@DesktopHeight - $h) / 2
$already = 0
$gui = GUICreate($win, $w, $h, $l, $t, $WS_MINIMIZEBOX + $WS_MAXIMIZEBOX )
$progress = GUICtrlCreateProgress(0, 0, $w - 6, 10 )
$edit = GUICtrlCreateEdit("", 0, 10, $w - 5, $h - 81, $ES_WANTRETURN + $ES_MULTILINE + $WS_TABSTOP + $ES_AUTOVSCROLL + $ES_AUTOHSCROLL + $WS_VSCROLL + $WS_HSCROLL )
$encrypt = GUICtrlCreateButton("E n c r y p t", 0, $h - 71, ($w / 3) - 2, 20)
$decrypt = GUICtrlCreateButton("D e c r y p t" , ($w / 3) -2, $h - 71, ($w / 3) - 2, 20)
$clipboard = GUICtrlCreateButton("C o p y" , ($w / 3 * 2)-4, $h - 71, ($w / 3) - 2, 20)
$password = GUICtrlCreateEdit ( "[ENTER PASSWORD HERE]", 0, $h - 51, $w - 5, 18)

GUISetBkColor("0xFFFFFF", $gui)

GUICtrlSetState($edit, $GUI_FOCUS)

WinSetOnTop($win, "", 1)

inex($gui)

GUISetState()

$temporary = "temporary"

While 1
    
    $cleared = 0
    $msg = GUIGetMsg()
    $curInfo = GUIGetCursorInfo()   
    Select
        Case $msg = $GUI_EVENT_CLOSE
            outex($gui)
            Exit
        Case $curInfo[2] = 1 AND $curInfo[4] = $password AND $cleared = 0
        $temporary = GUICtrlRead($edit)
        GUICtrlSetData($password,"")
        $cleared = 1
        Case WinActive($win) And Not $already
            $already = 1
            HotKeySet("^a", "selectall")
        Case Not WinActive($win) And $already
            $already = 0
            HotKeySet("^a")
        Case $msg = $decrypt                           ;--- Start Decryption ---;
            $sz_enc = GUICtrlRead($edit)
            $sz_orig = $sz_enc
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Fixing Nondisplayable Characters...")
            $sz_tmptxt = ""
            
            $k = StringSplit($sz_enc, "")
            $sz_enc = ""
            For $i = 1 To $k[0]
                $sz_enc = $sz_enc & normalize ($k[$i])
                GUICtrlSetData($progress, 100 - (($i / $k[0]) * 100))
            Next
            
            $square = Round(Sqrt(StringLen($sz_enc)), 0)
            If $square > 26 Then $square = 26
            $sz_text = StringSplit($sz_enc, "")
            
            $square2 = Round(($square /2), 0)
            
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Unshifting...")
            
            For $d = 1 To $sz_text[0]
                $sz_tmptxt = $sz_tmptxt & Chr(Asc($sz_text[$d]) - $square)
                GUICtrlSetData($progress, 100 - (($d / $sz_text[0]) * 100))
            Next
            
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Unscrambling...")
            
            For $f = 1 To $square2          
                $sz_tmptxt = _Unscramble($sz_tmptxt)
                GUICtrlSetData($progress, 100 - (($f / $square2) * 100))
            Next
            
            $sz_tmptxt = _StringToHex ($sz_tmptxt)
            $k = StringSplit($sz_tmptxt, "")
            $sz_tmptxt = ""
            
            For $i = 1 to ($k[0] - 1) Step 2
                $sz_tmptxt = $sz_tmptxt & FixVerticalTab($k[$i] & $k[$i + 1])
            Next
            $sz_tmptxt = _HexToString ($sz_tmptxt)
            
            
            GUICtrlSetData($edit, "")
            
            $pass = GuiCtrlRead($password)
            
            If $pass = "" or $pass = "[ENTER PASSWORD HERE]"  or $pass = "Invalid Password" Then 
            $pass = "[@]"
            Else
            $pass = "[" & GUICtrlRead($password) & "]"
            Endif

                
            If StringInStr ( $sz_tmptxt, $pass, 1 )  Then 
                $sz_tmptxt = StringReplace($sz_tmptxt, $pass, "", 1)
                GUICtrlSetData($edit, $sz_tmptxt)               
            Else
                GUICtrlSetData($edit, $sz_orig)
                GUICtrlSetData($password, "Invalid Password")
            endif
            ;--- End Decryption ---;
            ;--- Start Encryption ---;
            Case $msg = $encrypt                        
            $sz_dec = GUICtrlRead($edit)
            
            $pass = GuiCtrlRead($password)
            
            If $pass = "" or $pass = "[ENTER PASSWORD HERE]"  or $pass = "Invalid Password" Then  
            $pass = "[@]"
            Else
            $pass = "[" & GUICtrlRead($password) & "]"
            Endif
            
            
            $sz_dec = $pass & $sz_dec
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Shifting...")
            $sz_tmptxt = ""         
            
            $square = Round(Sqrt(StringLen($sz_dec)), 0)
            If $square > 26 Then $square = 26
            $sz_text = StringSplit($sz_dec, "")
            
            $square2 = Round(($square /2), 0)
            
            For $e = 1 To $sz_text[0]
                $sz_tmptxt = $sz_tmptxt & Chr(Asc($sz_text[$e]) + $square)
                GUICtrlSetData($progress, (($e / $sz_text[0]) * 100))
            Next
            
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Scrambling...")
            
            For $g = 1 To Round(($square2), 0)
                $sz_tmptxt = _Scramble($sz_tmptxt)
                GUICtrlSetData($progress, (($g / $square2) * 100))
            Next
            
            
            $k = StringSplit($sz_tmptxt, "")
            $sz_tmptxt = ""
            
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, "Fixing Nondisplayable Characters...")
            
            For $i = 1 To $k[0]
                $sz_tmptxt = $sz_tmptxt & unnormalize($k[$i])
                GUICtrlSetData($progress, (($i / $k[0]) * 100))
            Next
            GUICtrlSetData($edit, "")
            GUICtrlSetData($edit, $sz_tmptxt)            ;--- End Encryption ---;
        Case $msg = $clipboard
            ClipPut(GUICtrlRead($edit))
    EndSelect
    Sleep(1)
        
WEnd

Func selectall()
    Send("{SHIFTDOWN}{SHIFTUP}")
    Send("^{HOME}")
    Send("^+{END}")
EndFunc  ;==>selectall

Func _Scramble($sText)
;; Scramble a text string.
    $iLen = StringLen($sText)
    $Scrambled = ""
    For $i1 = 1 To Int($iLen / 2)
        $Scrambled = $Scrambled & StringMid($sText, $iLen - $i1 + 1, 1) & StringMid($sText, $i1, 1)
    Next; $i1
; Pick up the odd character.
    If Mod($iLen, 2) Then
        $Scrambled = $Scrambled & StringMid($sText, $i1, 1)
    EndIf
    Return $Scrambled
EndFunc  ;==>_Scramble


Func _Unscramble($sText)
;; De-Scramble a Scrambled text that was scrambled by _Scramble.
    Local $iLen = StringLen($sText)
    Local $i, $Unscrambled1, $Unscrambled2
    $Unscrambled1 = ""
    $Unscrambled2 = ""
    For $i1 = 1 To $iLen Step 2
        $Unscrambled1 = StringMid($sText, $i1, 1) & $Unscrambled1
        $Unscrambled2 = $Unscrambled2 & StringMid($sText, $i1 + 1, 1)
    Next; $i1
; Pick up the odd character.
    If Mod($iLen, 2) Then
        $Unscrambled1 = StringMid($sText, $i1, 1) & $Unscrambled1
    EndIf
    $sText = $Unscrambled2 & $Unscrambled1
    Return $Unscrambled2 & $Unscrambled1
EndFunc  ;==>_Unscramble

Func _IsAlpha($sz_str)
    Return StringInStr("abcdefghijklmnopqrstuvwxyz", $sz_str)
EndFunc  ;==>_IsAlpha



Func inex($hwnd)
    Dim $r = Random(1, 10, 1)
    Select
        Case $r = 1
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00080000)
        Case $r = 2
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040001)
        Case $r = 3
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040002)
        Case $r = 4
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040004)
        Case $r = 5
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040008)
        Case $r = 6
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040005)
        Case $r = 7
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040006)
        Case $r = 8
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040009)
        Case $r = 9
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0004000a)
        Case $r = 10
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00040010)
    EndSelect
    WinSetOnTop($win, "", 0)
EndFunc  ;==>inex

Func outex($hwnd)
    Dim $s = Random(1, 10, 1)
    Select
        Case $s = 1
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00090000)
        Case $s = 2
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050001)
        Case $s = 3
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050002)
        Case $s = 4
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050004)
        Case $s = 5
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050008)
        Case $s = 6
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050005)
        Case $s = 7
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050006)
        Case $s = 8
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050009)
        Case $s = 9
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x0005000a)
        Case $s = 10
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd, "int", 1000, "long", 0x00050010)
    EndSelect
EndFunc  ;==>outex

Func normalize ($character)
    
    Select
        Case $character = "÷"
            Return Chr("10")
        Case $character = "§" 
            Return Chr("11")
        Case $character = "®" 
            Return Chr("12")
        Case $character = "ñ"
            Return Chr("13")
        Case $character = "©"          
            Return Chr("14")
        Case $character = "¢" 
            Return Chr("15")
        Case $character = "»" 
            Return Chr("16")
        Case $character = "º" 
            Return Chr("17")
        Case $character = "Ö" 
            Return Chr("18")
        Case $character = "ë" 
            Return Chr("19")
        Case $character = "£" 
            Return Chr("20")
        Case $character = "" 
            Return Chr("21")
        Case $character = "" 
            Return Chr("22")
        Case $character = "" 
            Return Chr("23")
        Case $character = "" 
            Return Chr("24")
        Case $character = "¬" 
            Return Chr("25")
        Case $character = "±" 
            Return Chr("26")
        Case $character = "µ" 
            Return Chr("27")
        Case $character = "¶" 
            Return Chr("28")
        Case $character = "¿" 
            Return Chr("29")
        Case $character = "Ð" 
            Return Chr("30")
        Case $character = "å" 
            Return Chr("31")
            
        Case $character = "Ø" 
            Return Chr("0")
        Case $character = "Ù" 
            Return Chr("1")
        Case $character = "Ý" 
            Return Chr("2")
        Case $character = "æ" 
            Return Chr("3")
        Case $character = "ð" 
            Return Chr("4")
        Case $character = "À" 
            Return Chr("5")
        Case $character = "Á" 
            Return Chr("6")
        Case $character = "Ã" 
            Return Chr("7")
        Case $character = "Ç" 
            Return Chr("8")
        Case $character = "Ì" 
            Return Chr("9")
                EndSelect
            Return $character

EndFunc  ;==>normalize

Func unnormalize($character)
    
    Select
        Case $character = Chr("10")
            Return "÷"
        Case $character = Chr("11")
            Return "§" 
        Case $character = Chr("12")
            Return "®" 
        Case $character = Chr("13")
            Return "ñ" 
        Case $character = Chr("14")
            Return "©" 
        Case $character = Chr("15")
            Return "¢" 
        Case $character = Chr("16")
            Return "»" 
        Case $character = Chr("17")
            Return "º" 
        Case $character = Chr("18")
            Return "Ö" 
        Case $character = Chr("19")
            Return "ë" 
        Case $character = Chr("20")
            Return "£" 
        Case $character = Chr("21")
            Return "" 
        Case $character = Chr("22")
            Return "" 
        Case $character = Chr("23")
            Return "" 
        Case $character = Chr("24")
            Return "" 
        Case $character = Chr("25")
            Return "¬" 
        Case $character = Chr("26")
            Return "±" 
        Case $character = Chr("27")
            Return "µ" 
        Case $character = Chr("28")
            Return "¶" 
        Case $character = Chr("29")
            Return "¿" 
        Case $character = Chr("30")
            Return "Ð" 
        Case $character = Chr("31")
            Return "å" 
            
        Case $character = Chr("0")
            Return "Ø" 
        Case $character = Chr("1")
            Return "Ù" 
        Case $character = Chr("2")
            Return "Ý" 
        Case $character = Chr("3")
            Return "æ" 
        Case $character = Chr("4")
            Return "ð" 
        Case $character = Chr("5")
            Return "À" 
        Case $character = Chr("6")
            Return "Á" 
        Case $character = Chr("7")
            Return "Ã" 
        Case $character = Chr("8")
            Return "Ç" 
        Case $character = Chr("9")
            Return "Ì" 
    EndSelect
    Return $character
EndFunc  ;==>unnormalize
Func FixVerticalTab($sz_t)
    If $sz_t = "0B"  Then Return "0d" 
    Return $sz_t
EndFunc  ;==>FixVerticalTab

FINALLY DONE! check it out

Edit: ADDED PASSWORD ENCRYPTION!

Edited by datkewlguy
Link to comment
Share on other sites

Remember the entire argument in the last thread? That's still exponentially faster than what you're doing again. Try that out.

Otherwise, this needs to be changed:

If StringIsUpper($sz_t) Then
    If $sz_t = "B" Then Return "A"
    If $sz_t = "C" Then Return "B"
    If $sz_t = "D" Then Return "C"
    If $sz_t = "E" Then Return "D"
    If $sz_t = "F" Then Return "E"
    If $sz_t = "G" Then Return "F"
    If $sz_t = "H" Then Return "G"
    If $sz_t = "I" Then Return "H"
    If $sz_t = "J" Then Return "I"
    If $sz_t = "K" Then Return "J"
    If $sz_t = "L" Then Return "K"
    If $sz_t = "M" Then Return "L"
    If $sz_t = "N" Then Return "M"
    If $sz_t = "O" Then Return "N"
    If $sz_t = "P" Then Return "O"
    If $sz_t = "Q" Then Return "P"
    If $sz_t = "R" Then Return "Q"
    If $sz_t = "S" Then Return "R"
    If $sz_t = "T" Then Return "S"
    If $sz_t = "U" Then Return "T"
    If $sz_t = "V" Then Return "U"
    If $sz_t = "W" Then Return "V"
    If $sz_t = "X" Then Return "W"
    If $sz_t = "Y" Then Return "X"
    If $sz_t = "Z" Then Return "Y"
    If $sz_t = "A" Then Return "Z"
  EndIf
  If $sz_t = "b" Then Return "a"
  If $sz_t = "c" Then Return "b"
  If $sz_t = "d" Then Return "c"
  If $sz_t = "e" Then Return "d"
  If $sz_t = "f" Then Return "e"
  If $sz_t = "g" Then Return "f"
  If $sz_t = "h" Then Return "g"
  If $sz_t = "i" Then Return "h"
  If $sz_t = "j" Then Return "i"
  If $sz_t = "k" Then Return "j"
  If $sz_t = "l" Then Return "k"
  If $sz_t = "m" Then Return "l"
  If $sz_t = "n" Then Return "m"
  If $sz_t = "o" Then Return "n"
  If $sz_t = "p" Then Return "o"
  If $sz_t = "q" Then Return "p"
  If $sz_t = "r" Then Return "q"
  If $sz_t = "s" Then Return "r"
  If $sz_t = "t" Then Return "s"
  If $sz_t = "u" Then Return "t"
  If $sz_t = "v" Then Return "u"
  If $sz_t = "w" Then Return "v"
  If $sz_t = "x" Then Return "w"
  If $sz_t = "y" Then Return "x"
  If $sz_t = "z" Then Return "y"
  If $sz_t = "a" Then Return "z"

to something like this, which cuts 26 (or so) if's out

Local $return

If $sz_t = "b" Then $return = "a"
If $sz_t = "c" Then $return = "b"
If $sz_t = "d" Then $return = "c"
If $sz_t = "e" Then $return = "d"
If $sz_t = "f" Then $return = "e"
If $sz_t = "g" Then $return = "f"
If $sz_t = "h" Then $return = "g"
If $sz_t = "i" Then $return = "h"
If $sz_t = "j" Then $return = "i"
If $sz_t = "k" Then $return = "j"
If $sz_t = "l" Then $return = "k"
If $sz_t = "m" Then $return = "l"
If $sz_t = "n" Then $return = "m"
If $sz_t = "o" Then $return = "n"
If $sz_t = "p" Then $return = "o"
If $sz_t = "q" Then $return = "p"
If $sz_t = "r" Then $return = "q"
If $sz_t = "s" Then $return = "r"
If $sz_t = "t" Then $return = "s"
If $sz_t = "u" Then $return = "t"
If $sz_t = "v" Then $return = "u"
If $sz_t = "w" Then $return = "v"
If $sz_t = "x" Then $return = "w"
If $sz_t = "y" Then $return = "x"
If $sz_t = "z" Then $return = "y"
If $sz_t = "a" Then $return = "z"
    
If StringIsUpper($sz_t) Then
    $return = StringUpper ( $return )
EndIf

And YES replace that with cases, their 3-5% faster.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Or better yet... (what I suggested before)

$sString = "Encrypting me softly"
; Breaking up string
$arString = StringSplit ( $sString, "" )

; Loading buffers
Local $sTemp = "", $iASCII = 0, $i = 0

; Looping through each character
For $i = 1 to $arString[0]
; Adding 5 to the characters ASCII value
    $iASCII = ASC ( $arString[$i] ) + 5
    
; Adding to buffer
    $sTemp = Chr( $iASCII ) & $sTemp
Next

; Copying buffer
$sString = $sTemp

; Displaying encrypted string
MsgBox("","Encrypted", $sString)

; Clearing buffers
Local $sTemp = "", $iASCII = 0, $i = 0

; Breaking up encrypted string
$arString = StringSplit ( $sString, "" )

; Looping through each character
For $i = 1 to $arString[0]
; Subtracting 5 from the characters ASCII value
    $iASCII = ASC ( $arString[$i] ) - 5
    
; Adding to buffer
    $sTemp = Chr( $iASCII ) & $sTemp
Next

; Displaying decrypted string
MsgBox("","Decrypted", $sTemp)
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

What code?

Paste what you got.

EDIT:

Oh, first post, gimmie a few.

Doing this works:

Func abcdef2($sz_t)
    Local $Return
    
    Select
        Case $sz_t = "b"

EDIT:

For Pete's sake, use the friggin' ASCII shift method I've been mentioning since you first posted this. Now as you're trying to update this you encounter problems, I hope you see the 2nd biggest benefit of that method. First being the fact that it's many many times faster.

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

For Pete's sake, use the friggin' ASCII shift method I've been mentioning since you first posted this.  Now as you're trying to update this you encounter problems, I hope you see the 2nd biggest benefit of that method.  First being the fact that it's many many times faster.

<{POST_SNAPBACK}>

Okay we'll use your method, wait for it in the first post!

EDIT: Im using your ascii shift only ive made it so it won't spawn the problems it would normally create.

Edited by datkewlguy
Link to comment
Share on other sites

Nice, looks pretty good :(

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Okay, we just updated the code again, however, the problem we anticipated has begun. Type a phrase with a couple Enters... notice that in the shifting, they are transformed into non displaying characters. These characters are not supported in most programs and therefore phrases will be lost in translation. I have tried using string replace to replace all the non displaying characters, but it doesnt seem to work for this... Any ideas?

Link to comment
Share on other sites

Change how it shifts? If it's going to shift into the non-displaying characters shift it backwards, or something, and save in a 'key' (or something) how it has been shifted, or how it should be shifted back.

EDIT:

Also, I'm not sure if it should matter whether it's 'displayed' or not, as long as you can decrypt it.

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Your styles, like for the Edit control, shouldn't be added together. They should be BitOr'd.

$edit = GUICtrlCreateEdit("", 0, 0, $w - 5, $h - 51, $ES_WANTRETURN + $ES_MULTILINE + $WS_TABSTOP + $ES_AUTOVSCROLL + $ES_AUTOHSCROLL + $WS_VSCROLL + $WS_HSCROLL)

Should be:

$edit = GUICtrlCreateEdit("", 0, 0, $w - 5, $h - 51, BitOr($ES_WANTRETURN, $ES_MULTILINE, $WS_TABSTOP, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_VSCROLL, $WS_HSCROLL))

Not that I understand why you have all that style declaration in there anyway, as that appears to be the default style for an Edit control.

Same thing for your left ($l) and top ($t) variables. You use script to figure out the middle of the screen positioning... when if you put -1 in those parameters, it defaults to the center of the screen anyway.

And, this is just a suggestion, but you know what would be cool? If you used a Progress control instead of a tooltip to show percentage of completion.

Link to comment
Share on other sites

Updated with progress bar at top.

Also, @Insolence, the characters need to be displaying, or when sent through email or an instant messenger service (which is likely the entire point of this...) characters will be lost, and watch wht happens when you take out enough numbers to mess up the square root...

See, it has to keep everything at the origional string length. The encryption method is based off the string length, and in return, so is the decryption. So if the length changes, it will shift characters and scramble/unscramble too many, or too little times.

*We updated the code above with the (un)scramble functions along with some other minor tweaks. These functions (while much slower) add most of the security. They add a system of checks and balances, so now it doesnt rely on only one exposed method of encryption. The two methods each make the other harder to crack.

Thank you Insolence, again, for your encryption method of shifting characters. It really helped! :(

Edited by datkewlguy
Link to comment
Share on other sites

Once again that's horribly inefficient. What's this used for anyway?

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

$sz_enc = StringReplace($sz_enc, "§", Chr("0B"))
    $sz_enc = StringReplace($sz_enc, "®", Chr("0C"))
    $sz_enc = StringReplace($sz_enc, "©", Chr("0E"))
    $sz_enc = StringReplace($sz_enc, "¢", Chr("0F"))
    $sz_enc = StringReplace($sz_enc, "»", Chr("10"))
    $sz_enc = StringReplace($sz_enc, "º", Chr("11"))
    $sz_enc = StringReplace($sz_enc, "Ö", Chr("12"))
    $sz_enc = StringReplace($sz_enc, "ë", Chr("13"))
    $sz_enc = StringReplace($sz_enc, "£", Chr("14"))
    $sz_enc = StringReplace($sz_enc, "", Chr("15"))
    $sz_enc = StringReplace($sz_enc, "", Chr("16"))
    $sz_enc = StringReplace($sz_enc, "", Chr("17"))
    $sz_enc = StringReplace($sz_enc, "", Chr("18"))
    $sz_enc = StringReplace($sz_enc, "¬", Chr("19"))
    $sz_enc = StringReplace($sz_enc, "±", Chr("1A"))
    $sz_enc = StringReplace($sz_enc, "µ", Chr("1B"))
    $sz_enc = StringReplace($sz_enc, "¶", Chr("1C"))
    $sz_enc = StringReplace($sz_enc, "¿", Chr("1D"))
    $sz_enc = StringReplace($sz_enc, "Ð", Chr("1E"))
    $sz_enc = StringReplace($sz_enc, "å", Chr("1F"))
    
    $sz_enc = StringReplace($sz_enc, "Ø", Chr("00"))
    $sz_enc = StringReplace($sz_enc, "Ù", Chr("01"))
    $sz_enc = StringReplace($sz_enc, "Ý", Chr("02"))
    $sz_enc = StringReplace($sz_enc, "æ", Chr("03"))
    $sz_enc = StringReplace($sz_enc, "ð", Chr("04"))
    $sz_enc = StringReplace($sz_enc, "À", Chr("05"))
    $sz_enc = StringReplace($sz_enc, "Á", Chr("06"))
    $sz_enc = StringReplace($sz_enc, "Ã", Chr("07"))
    $sz_enc = StringReplace($sz_enc, "Ç", Chr("08"))
    $sz_enc = StringReplace($sz_enc, "Ì", Chr("09"))

Is horribly inefficient.

What programs are you trying to use this with? Why are you even encrypting?

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

$sz_enc = StringReplace($sz_enc, "§", Chr("0B"))
    $sz_enc = StringReplace($sz_enc, "®", Chr("0C"))
    $sz_enc = StringReplace($sz_enc, "©", Chr("0E"))
    $sz_enc = StringReplace($sz_enc, "¢", Chr("0F"))
    $sz_enc = StringReplace($sz_enc, "»", Chr("10"))
    $sz_enc = StringReplace($sz_enc, "º", Chr("11"))
    $sz_enc = StringReplace($sz_enc, "Ö", Chr("12"))
    $sz_enc = StringReplace($sz_enc, "ë", Chr("13"))
    $sz_enc = StringReplace($sz_enc, "£", Chr("14"))
    $sz_enc = StringReplace($sz_enc, "", Chr("15"))
    $sz_enc = StringReplace($sz_enc, "", Chr("16"))
    $sz_enc = StringReplace($sz_enc, "", Chr("17"))
    $sz_enc = StringReplace($sz_enc, "", Chr("18"))
    $sz_enc = StringReplace($sz_enc, "¬", Chr("19"))
    $sz_enc = StringReplace($sz_enc, "±", Chr("1A"))
    $sz_enc = StringReplace($sz_enc, "µ", Chr("1B"))
    $sz_enc = StringReplace($sz_enc, "¶", Chr("1C"))
    $sz_enc = StringReplace($sz_enc, "¿", Chr("1D"))
    $sz_enc = StringReplace($sz_enc, "Ð", Chr("1E"))
    $sz_enc = StringReplace($sz_enc, "å", Chr("1F"))
    
    $sz_enc = StringReplace($sz_enc, "Ø", Chr("00"))
    $sz_enc = StringReplace($sz_enc, "Ù", Chr("01"))
    $sz_enc = StringReplace($sz_enc, "Ý", Chr("02"))
    $sz_enc = StringReplace($sz_enc, "æ", Chr("03"))
    $sz_enc = StringReplace($sz_enc, "ð", Chr("04"))
    $sz_enc = StringReplace($sz_enc, "À", Chr("05"))
    $sz_enc = StringReplace($sz_enc, "Á", Chr("06"))
    $sz_enc = StringReplace($sz_enc, "Ã", Chr("07"))
    $sz_enc = StringReplace($sz_enc, "Ç", Chr("08"))
    $sz_enc = StringReplace($sz_enc, "Ì", Chr("09"))

Is horribly inefficient.

What programs are you trying to use this with?  Why are you even encrypting?

<{POST_SNAPBACK}>

Yes i know that is horrible, but it was a desperate attempt to replace the characters that would not display. It didn't work anyways, but if you have a better idea i'd love to hear it, seriously i'm out of ways to do this using your methods.

Im just doing this because its fun and my latest hobby lol.

Im just using this with aol and AIM for the most part, but at this point many things translated with this method are lost when used with these things.

Link to comment
Share on other sites

Well yeah, that's going to happen with AIM, they apply formatting and filter text and such.

Maybe you should make your own chat program, eh? Each participant must have a 'key' to decrypt eachothers messages, that sounds cool to me :(

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...