Jump to content

Secret Message


JustinReno
 Share

Recommended Posts

This program was made to encode/decode messages. Using 1-26 as a-z. The only punctuation mark it supports is a period.

Decoder By: CRZFTX

Encoder By : Aslani

This is unfinished

Here is the code:

$GUI = GUICreate("Secret Message", 314, 394)
GUICtrlCreateTab(0, 0, 313, 393)
GUICtrlCreateTabItem("Encode")
GUICtrlCreateLabel("Message to Encode:", 8, 24, 102, 17)
$MessagetoEncode = GUICtrlCreateEdit("", 9, 40, 295, 129)
GUICtrlCreateLabel("Encoded Message:", 8, 208, 96, 17)
$EncodedMessage = GUICtrlCreateEdit("", 8, 224, 297, 129)
$Encode = GUICtrlCreateButton("Encode", 8, 176, 299, 25, 0)
$CopytoClipboard1 = GUICtrlCreateButton("Copy to Clipboard", 8, 360, 299, 25, 0)
GUICtrlCreateTabItem("Decode")
GUICtrlCreateLabel("Message to Decode:", 8, 24, 103, 17)
$MessagetoDecode = GUICtrlCreateEdit("", 8, 40, 295, 129)
$Decode = GUICtrlCreateButton("Decode", 8, 176, 299, 25, 0)
GUICtrlCreateLabel("Decoded Message:", 8, 208, 97, 17)
$DecodedMessage  = GUICtrlCreateEdit("", 8, 224, 295, 129)
$CopytoClipboard2 = GUICtrlCreateButton("Copy to Clipboard", 8, 360, 299, 25, 0)
GUICtrlCreateTabItem("About")
GUICtrlCreateLabel("Created By:", 112, 32, 59, 17)
GUICtrlCreateLabel("Justin Reno", 56, 48, 183, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlCreateLabel("Secret Message copyright Justin Reno 2007.", 48, 88, 216, 17)
$FirstLink = GUICtrlCreateLabel("www.AutoItScript.com", 48, 120, 187, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$SecondLink = GUICtrlCreateLabel("www.JustinReno.tk", 64, 144, 163, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateLabel("Have Fun!", 104, 184, 77, 24)
GUICtrlSetFont(-1, 12, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateLabel("Contact: JustinReno@JustinReno.tk", 8, 360, 302, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008080)
GUICtrlCreateLabel("This program was created in the wonderfull scripting", 24, 216, 248, 17)
GUICtrlSetColor(-1, 0x800000)
GUICtrlCreateLabel("language named AutoIt.", 88, 232, 117, 17)
GUICtrlSetColor(-1, 0x800000)
$Pic = GUICtrlCreatePic(@TempDir&"\AutoIt.jpg", 88, 256, 116, 100)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $Encode
            _Encode(GUICtrlRead($MessagetoEncode))
        Case $CopytoClipboard1
            ClipPut(GUICtrlRead($EncodedMessage))
        Case $Decode
            _Decode(GUICtrlRead($MessagetoDecode))
        Case $CopytoClipboard2
            ClipPut(GUICtrlRead($DecodedMessage))
        Case $FirstLink
            ShellExecute("www.AutoItScript.com")
        Case $SecondLink
            ShellExecute("www.JustinReno.tk")
    EndSwitch
WEnd

Func _Encode($Message)
$Input = StringLower($Message)
$Output = ""
While StringLen($Input) > 0
    Select
        Case StringLeft($Input ,1) = " "
            $Output &= " "
            $Input = StringTrimLeft($Input, 1)
        Case StringLeft($Input, 1) = "."
            $Output &= "."
            $Input = StringTrimLeft($Input, 1)
        Case StringLeft($Input, 2) <> StringLeft($Input, 1) & " "
            $Output &= Asc(StringLeft($Input, 1))-96 & "|"
            $Input = StringTrimLeft($Input, 1)
        Case StringLeft($Input, 1)
            $Output &= Asc(StringLeft($Input, 1))-96
            $Input = StringTrimLeft($Input, 1)
    EndSelect
WEnd
$Output = StringTrimRight($Output, 1)
GUICtrlSetData($EncodedMessage, $Output)
$Message = ""
EndFunc

Func _Decode($Message)
$Output = ""
While StringLen($Message) > 0
    Select
        Case StringLeft($Message, 1) = " "
            $Output &= " "
            $Message = StringTrimLeft($Message, 1)
        Case StringLeft($Message, 1) = "."
            $Output &= "."
            $Message = StringTrimLeft($Message, 1)
        Case Number(StringLeft($Message, 2)) <> Number(StringLeft($Message, 1))
            $Output &= Chr(96+Number(StringLeft($Message, 2)))
            $Message = StringTrimLeft($Message, 2)
        Case Number(StringLeft($Message, 1))
            $Output &= Chr(96+Number(StringLeft($Message, 1)))
            $Message = StringTrimLeft($Message, 1)
        Case StringLeft($Message, 1) = "|"
            $Message = StringTrimLeft($Message, 1)
    EndSelect
WEnd
GUICtrlSetData($DecodedMessage, $Message)
EndFunc

Have Fun.

Edited by JustinReno
Link to comment
Share on other sites

Try coding up affine and hill ciphers too. They are classics.

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

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

I've never done much with the Hill cipher, but I know the affine cipher is pretty easy to do

essentially pick and a and b such that 1<=a<=25, 0<=b<=25 where GCD(a,m)=1

then its just

Encrypted = MOD(a*PlainText+b, 26)

and the decryption requires you to find an inverse, but thats pretty easy to do (mod 26).

Edited by Wus
Link to comment
Share on other sites

Not happy with _StringEncrypt()?

Actually I just spotted a problem with _StringEncrypt(0 yesterday but I have not had time to put a demo script together yet.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

What was the problem?

I'll post an example when I get a chance but it had to do with using _StringEncrypt(0 on an empty string. I was doing it from an IniRead(). I THINK this will probably show it but I'll check later

$a = _StringEncrypt(0, "", "trythis")

MsgBox(0, "TEST", $a)

I'm still going to have a problem using _StringEncrypt to do what I want anyway but I'll get into that later.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I don't think its a bug/problem. It can't encrypt an empty string.

That was the problem. "_StringEncrypt(0" means decrypt and it was decrypting an empty string, in other words there was a return in the message box. As soon as I get time I'll pull the script and post part of it in Help.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Func enc($string)
    $bin = StringToBinary($string)
    $bin = StringTrimLeft($bin, 2)
    $sl = StringLen($bin)
    $newbin = ''
    for $i = 1 to $sl step 2
        $chunk = '0x' & StringMid($bin, $i, 2)
        $inv = Hex(BitXOR($chunk, 0xFF), 2)
        $newbin &= $inv
    next
    Return BinaryToString('0x' & $newbin)
EndFunc

Just whipped this one up myself. :)

I'm sure it'd be easy enough to "crack", but for simple purposes...

¶ßßßßÏÏßßßßßØßßÞ

Link to comment
Share on other sites

This program was made to encode/decode messages. Using 1-26 as a-z. The only punctuation mark it supports is a period.

Decoder By: CRZFTX

Encoder By : Aslani

This is unfinished

Here is the code:

$GUI = GUICreate("Secret Message", 314, 394)
GUICtrlCreateTab(0, 0, 313, 393)
GUICtrlCreateTabItem("Encode")
GUICtrlCreateLabel("Message to Encode:", 8, 24, 102, 17)
$MessagetoEncode = GUICtrlCreateEdit("", 9, 40, 295, 129)
GUICtrlCreateLabel("Encoded Message:", 8, 208, 96, 17)
$EncodedMessage = GUICtrlCreateEdit("", 8, 224, 297, 129)
$Encode = GUICtrlCreateButton("Encode", 8, 176, 299, 25, 0)
$CopytoClipboard1 = GUICtrlCreateButton("Copy to Clipboard", 8, 360, 299, 25, 0)
GUICtrlCreateTabItem("Decode")
GUICtrlCreateLabel("Message to Decode:", 8, 24, 103, 17)
$MessagetoDecode = GUICtrlCreateEdit("", 8, 40, 295, 129)
$Decode = GUICtrlCreateButton("Decode", 8, 176, 299, 25, 0)
GUICtrlCreateLabel("Decoded Message:", 8, 208, 97, 17)
$DecodedMessage  = GUICtrlCreateEdit("", 8, 224, 295, 129)
$CopytoClipboard2 = GUICtrlCreateButton("Copy to Clipboard", 8, 360, 299, 25, 0)
GUICtrlCreateTabItem("About")
GUICtrlCreateLabel("Created By:", 112, 32, 59, 17)
GUICtrlCreateLabel("Justin Reno", 56, 48, 183, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlCreateLabel("Secret Message copyright Justin Reno 2007.", 48, 88, 216, 17)
$FirstLink = GUICtrlCreateLabel("www.AutoItScript.com", 48, 120, 187, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$SecondLink = GUICtrlCreateLabel("www.JustinReno.tk", 64, 144, 163, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlCreateLabel("Have Fun!", 104, 184, 77, 24)
GUICtrlSetFont(-1, 12, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateLabel("Contact: JustinReno@JustinReno.tk", 8, 360, 302, 28)
GUICtrlSetFont(-1, 14, 400, 4, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008080)
GUICtrlCreateLabel("This program was created in the wonderfull scripting", 24, 216, 248, 17)
GUICtrlSetColor(-1, 0x800000)
GUICtrlCreateLabel("language named AutoIt.", 88, 232, 117, 17)
GUICtrlSetColor(-1, 0x800000)
$Pic = GUICtrlCreatePic(@TempDir&"\AutoIt.jpg", 88, 256, 116, 100)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $Encode
            _Encode(GUICtrlRead($MessagetoEncode))
        Case $CopytoClipboard1
            ClipPut(GUICtrlRead($EncodedMessage))
        Case $Decode
            _Decode(GUICtrlRead($MessagetoDecode))
        Case $CopytoClipboard2
            ClipPut(GUICtrlRead($DecodedMessage))
        Case $FirstLink
            ShellExecute("www.AutoItScript.com")
        Case $SecondLink
            ShellExecute("www.JustinReno.tk")
    EndSwitch
WEnd

Func _Encode($Message)
$Input = StringLower($Message)
$Output = ""
While StringLen($Input) > 0
    Select
        Case StringLeft($Input ,1) = " "
            $Output &= " "
            $Input = StringTrimLeft($Input, 1)
        Case StringLeft($Input, 1) = "."
            $Output &= "."
            $Input = StringTrimLeft($Input, 1)
        Case StringLeft($Input, 2) <> StringLeft($Input, 1) & " "
            $Output &= Asc(StringLeft($Input, 1))-96 & "|"
            $Input = StringTrimLeft($Input, 1)
        Case StringLeft($Input, 1)
            $Output &= Asc(StringLeft($Input, 1))-96
            $Input = StringTrimLeft($Input, 1)
    EndSelect
WEnd
$Output = StringTrimRight($Output, 1)
GUICtrlSetData($EncodedMessage, $Output)
$Message = ""
EndFunc

Func _Decode($Message)
$Output = ""
While StringLen($Message) > 0
    Select
        Case StringLeft($Message, 1) = " "
            $Output &= " "
            $Message = StringTrimLeft($Message, 1)
        Case StringLeft($Message, 1) = "."
            $Output &= "."
            $Message = StringTrimLeft($Message, 1)
        Case Number(StringLeft($Message, 2)) <> Number(StringLeft($Message, 1))
            $Output &= Chr(96+Number(StringLeft($Message, 2)))
            $Message = StringTrimLeft($Message, 2)
        Case Number(StringLeft($Message, 1))
            $Output &= Chr(96+Number(StringLeft($Message, 1)))
            $Message = StringTrimLeft($Message, 1)
        Case StringLeft($Message, 1) = "|"
            $Message = StringTrimLeft($Message, 1)
    EndSelect
WEnd
GUICtrlSetData($DecodedMessage, $Message)
EndFunc

Have Fun.

oks o ive posted my code!... its not very good scripting tho.. very noobish

Thank
Link to comment
Share on other sites

What?

He is just spamming and has been warned. I am sure if he continues he will find himself mentioned in a very different thread.

Edit - Sorry Gary, I did not see you posting.

Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

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...