Joke758 Posted December 31, 2006 Posted December 31, 2006 (edited) Thanks to RazerM for his RC4 function! expandcollapse popup;By Joke758 If Msgbox ( 4, "Shorthand", "Encode(yes) or decode(no)?" ) = 6 Then $file = FileOpenDialog ( "Choose a file", @scriptdir, "JPG Files (*.jpg)|Any Files (*.*)" ) $message = InputBox ( "Shorthand", "Choose a message to hide in the jpg", "", "", -1, 100, -1, -1 ) $hex = FileRead ( $file ) $temp = StringInStr ( $hex, "!-)" ) If $temp <> 0 Then $hex = StringTrimRight ( $hex, StringLen ( $hex )-$temp+1 ) $hex &= "!-)" $hex = _StringToHexEx ( $hex ) & _StringEncryptRC4 ( $message, "Joke758" ) $open = FileOpen ( "output.jpg", 2 ) FileWrite ( $open, _HexToStringEx( $hex ) ) Msgbox ( 64, "ShortHand", "Message successfully encoded in "&@scriptdir&"\output.jpg" ) Else $file = FileOpenDialog ( "Choose a file", @scriptdir, "JPG Files (*.jpg)|Any Files (*.*)" ) $str = FileRead ( $file ) $num = StringInStr ( $str, "!-)" )+2 If $num = 2 Then Msgbox ( 16, "ShortHand", "Error, no message found." ) Exit EndIf $msg = _StringDecryptRC4 ( _StringToHexEx ( StringTrimLeft ( $str, $num ) ), "Joke758" ) Msgbox ( 0, "Shorthand", "Decoded message: "&$msg ) EndIf Func _HexToStringEx($strHex) Return BinaryString("0x" & $strHex) EndFunc ;==>_HexToStringEx Func _StringToHexEx($strChar) Return Hex(BinaryString($strChar)) EndFunc ;==>_StringToHexEx ;=============================================================================== ; ; Function Name: _StringEncryptRC4 ; Description:: Encrypts text using RC4 Encryption ; Parameter(s): $text, $encryptkey ; Requirement(s): AutoIt ; Return Value(s): Encrypted String ; Author(s): RazerM ; ;=============================================================================== ; Func _StringEncryptRC4($text, $encryptkey) Local $sbox[256] Local $key[256] Local $temp Local $a Local $i Local $j Local $k Local $cipherby Local $cipher $i = 0 $j = 0 __RC4Initialize($encryptkey, $key, $sbox) For $a = 1 To StringLen($text) $i = Mod(($i + 1),256) $j = Mod(($j + $sbox[$i]),256) $temp = $sbox[$i] $sbox[$i] = $sbox[$j] $sbox[$j] = $temp $k = $sbox[Mod(($sbox[$i] + $sbox[$j]),256)] $cipherby = BitXOR(Asc(StringMid($text, $a, 1)),$k) $cipher = $cipher & Chr($cipherby) Next Return _StringToHexEx($cipher) EndFunc ;==>_StringEncryptRC4 ;=============================================================================== ; ; Function Name: _StringDecryptRC4 ; Description:: Decrypts text using RC4 Encryption ; Parameter(s): $text, $encryptkey ; Requirement(s): AutoIt ; Return Value(s): Decrypted String ; Author(s): RazerM ; Note(s): RC4 uses the same algorithm to encrypt and decrypt ; ;=============================================================================== ; Func _StringDecryptRC4($text, $encryptkey) Local $sbox[256] Local $key[256] Local $temp Local $a Local $i Local $j Local $k Local $cipherby Local $cipher $text = _HexToStringEx($text) $i = 0 $j = 0 __RC4Initialize($encryptkey, $key, $sbox) For $a = 1 To StringLen($text) $i = Mod(($i + 1),256) $j = Mod(($j + $sbox[$i]),256) $temp = $sbox[$i] $sbox[$i] = $sbox[$j] $sbox[$j] = $temp $k = $sbox[Mod(($sbox[$i] + $sbox[$j]),256)] $cipherby = BitXOR(Asc(StringMid($text, $a, 1)),$k) $cipher = $cipher & Chr($cipherby) Next Return $cipher EndFunc ;==>_StringDecryptRC4 ; Helper function Func __RC4Initialize($strPwd, ByRef $key, ByRef $sbox) Dim $tempSwap Dim $a Dim $b $intLength = StringLen($strPwd) For $a = 0 To 255 $key[$a] = Asc(StringMid($strPwd, (Mod($a,$intLength))+1, 1)) $sbox[$a] = $a Next $b = 0 For $a = 0 To 255 $b = Mod($b + $sbox[$a] + $key[$a],256) $tempSwap = $sbox[$a] $sbox[$a] = $sbox[$b] $sbox[$b] = $tempSwap Next EndFunc ;==>__RC4Initialize Edited January 4, 2007 by Joke758 [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!
WeMartiansAreFriendly Posted December 31, 2006 Posted December 31, 2006 cool burritoes. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Skrip Posted December 31, 2006 Posted December 31, 2006 Decode doesn't seem to work... [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
XxXFaNtA Posted December 31, 2006 Posted December 31, 2006 Works for me...great I used something similar..but this is way better i guess... My Script changed the color of specific pixels (but not realizable) to save the letters . Great job on that one Greetz, FaNtA /[center][/center]
RazerM Posted December 31, 2006 Posted December 31, 2006 @Firestorm The file with the message is output.jpg not the original. Nice script Joke758. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Joke758 Posted December 31, 2006 Author Posted December 31, 2006 Thanks! Your RC4 function is like 1000 times better than _StringEncrypt(). [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!
Skrip Posted December 31, 2006 Posted December 31, 2006 @FirestormThe file with the message is output.jpg not the original. Nice script Joke758.Ahh, thanks. Good job man! [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
dandymcgee Posted January 3, 2007 Posted January 3, 2007 How 'bout a "Remove" function to take the message back out of the picture? Tried to simply re-encode it with a different message, but when decoded the first message remained and a bunch of junk was added. Remove function would be useful. - Dan [Website]
Joke758 Posted January 4, 2007 Author Posted January 4, 2007 How 'bout a "Remove" function to take the message back out of the picture? Tried to simply re-encode it with a different message, but when decoded the first message remained and a bunch of junk was added. Remove function would be useful.Added. See first post. If the picture already contain a secret message, it will be overwritted. [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own!
A. Percy Posted January 4, 2007 Posted January 4, 2007 Nice job! Cheers, Alexsandro Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator VW Bug user Pinheiral (Pinewood) city: http://pt.wikipedia.org/wiki/Pinheiral
BillLuvsU Posted May 15, 2007 Posted May 15, 2007 Cool stuff mate. Great example on how to exploit an image format too. =] [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
James Posted May 15, 2007 Posted May 15, 2007 Nice!!! I like this. There was something like this before. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now