Paradox Posted July 20, 2006 Share Posted July 20, 2006 Okay, so now I'm finally working on my own project right now... it's pretty simple... just a text to binary convertor.. nothing elaborate.I've taken a quick look through the help on the lastest Beta, and it appears as though the only built in binary function is the BinaryString() however, from what i've read, it doesn't return the absolute binary value of the expression.That being said (and provided that I'm right about my assumption) does anyone have any kind of snippets or insight into how this can be accomplished?FYI, the converted text could 1 character to possibly an entire paragraph long... just for doing simple message encoding... Link to comment Share on other sites More sharing options...
Paradox Posted July 20, 2006 Author Share Posted July 20, 2006 text -> binarydescribe what you mean by binary? 001100100 or 00 - FF or what?LAr.Sorry... 001100100 is the preferred export per character Link to comment Share on other sites More sharing options...
w0uter Posted July 20, 2006 Share Posted July 20, 2006 search the board. there are udf's that do this. or write your own My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
death pax Posted July 20, 2006 Share Posted July 20, 2006 (edited) I actually did this a while back for a pet project of mine... Byte2Bit... but it was ugly... i ended up writing a per hex value bit table... expandcollapse popupFunc ByteToBit($TheByte) #region -- BitChart local $BitChart[16][2] $BitChart[0][0]="0" $BitChart[1][0]="1" $BitChart[2][0]="2" $BitChart[3][0]="3" $BitChart[4][0]="4" $BitChart[5][0]="5" $BitChart[6][0]="6" $BitChart[7][0]="7" $BitChart[8][0]="8" $BitChart[9][0]="9" $BitChart[10][0]="A" $BitChart[11][0]="B" $BitChart[12][0]="C" $BitChart[13][0]="D" $BitChart[14][0]="E" $BitChart[15][0]="F" $BitChart[0][1]="0000" $BitChart[1][1]="0001" $BitChart[2][1]="0010" $BitChart[3][1]="0011" $BitChart[4][1]="0100" $BitChart[5][1]="0101" $BitChart[6][1]="0110" $BitChart[7][1]="0111" $BitChart[8][1]="1000" $BitChart[9][1]="1001" $BitChart[10][1]="1010" $BitChart[11][1]="1011" $BitChart[12][1]="1100" $BitChart[13][1]="1101" $BitChart[14][1]="1110" $BitChart[15][1]="1111" #endregion -- BitChart for $i=0 to 15 step 1 if $thebyte = $BitChart[$i][0] Then return $BitChart[$i][1] exitloop Else EndIf Next When i rewrote the program, i ended up not even bothering with it, and did everything with Bitwise operators Bitwise operators > using string functions on binary Edited July 20, 2006 by death pax Link to comment Share on other sites More sharing options...
Paradox Posted July 20, 2006 Author Share Posted July 20, 2006 I actually did this a while back for a pet project of mine... Byte2Bit... but it was ugly... i ended up writing a per hex value bit table... expandcollapse popupFunc ByteToBit($TheByte) #region -- BitChart local $BitChart[16][2] $BitChart[0][0]="0" $BitChart[1][0]="1" $BitChart[2][0]="2" $BitChart[3][0]="3" $BitChart[4][0]="4" $BitChart[5][0]="5" $BitChart[6][0]="6" $BitChart[7][0]="7" $BitChart[8][0]="8" $BitChart[9][0]="9" $BitChart[10][0]="A" $BitChart[11][0]="B" $BitChart[12][0]="C" $BitChart[13][0]="D" $BitChart[14][0]="E" $BitChart[15][0]="F" $BitChart[0][1]="0000" $BitChart[1][1]="0001" $BitChart[2][1]="0010" $BitChart[3][1]="0011" $BitChart[4][1]="0100" $BitChart[5][1]="0101" $BitChart[6][1]="0110" $BitChart[7][1]="0111" $BitChart[8][1]="1000" $BitChart[9][1]="1001" $BitChart[10][1]="1010" $BitChart[11][1]="1011" $BitChart[12][1]="1100" $BitChart[13][1]="1101" $BitChart[14][1]="1110" $BitChart[15][1]="1111" #endregion -- BitChart for $i=0 to 15 step 1 if $thebyte = $BitChart[$i][0] Then return $BitChart[$i][1] exitloop Else EndIf Next When i rewrote the program, i ended up not even bothering with it, and did everything with Bitwise operators Bitwise operators > using string functions on binary what i'm wanting to do with it is have a simple little conversation to binary convertor... you know, type in your message, click a button, viola! it's in binary.... and then at the same point in time have it so that you can paste in the binary code and convert it back to text. Make sense now? Link to comment Share on other sites More sharing options...
w0uter Posted July 20, 2006 Share Posted July 20, 2006 This is my attempt $b_byte = Asc('W') ConsoleWrite(_Bin($b_byte) & @LF) Func _Bin($b_byte) $s_buffer = '' For $i = 0 to 7 $s_buffer = BitAND($b_byte, 1) & $s_buffer $b_byte = BitShift($b_byte, 1) Next return $s_buffer EndFunc just do it for evry character My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Paradox Posted July 20, 2006 Author Share Posted July 20, 2006 (edited) This is my attempt expandcollapse popup$b_byte = Asc('W') ConsoleWrite(_Bin($b_byte) & @LF) Func _Bin($b_byte) $s_buffer = '' For $i = 0 to 7 $s_buffer = BitAND($b_byte, 1) & $s_buffer $b_byte = BitShift($b_byte, 1) Next return $s_buffer EndFuncoÝ÷ Ú;¬µÚ"µú+zúòr«iË^¯ú®¢×¬¬¡§íz¹®r(צ¦VÚÚÞjX³x-«mêÞÆ¥æɦî[bËkx-¢±jwoǯz»"·°®^Ùbë(jëh×6#include <GUIConstants.au3> #include <string.au3> $extract=@scriptdir & "\ignite.jpg" fileinstall("E:\Projects\HexVert\ignite.jpg", $extract, 1) guicreate("HexVert by ParaDoX v1.0", 640, 480) guisetfont(11, 450) guictrlcreatepic("ignite.jpg", 0, 0, 640, 480) $text=guictrlcreateinput("", 90, 10, 530, 200) $hex=guictrlcreateinput("", 90, 240, 530, 200) guictrlcreatelabel("Txt :", 10, 10, 55, 17) guictrlcreatelabel("Hex :", 10, 240, 55, 17) $txt2hex=guictrlcreatebutton("txt2hex", 10, 30, 60, 20) $hex2txt=guictrlcreatebutton("hex2txt", 10, 260, 60, 20) guisetstate(@SW_SHOW) while 1 $msg = guigetmsg() select case $msg = $gui_event_close filedelete("ignite.jpg") exit case $msg = $txt2hex $convert=GUICtrlRead($text) $hexvert=_stringToHex($convert) guictrlsetdata($hex, $hexvert) case $msg = $hex2txt $convert=GUICtrlRead($hex) $hexvert=_hextostring($convert) guictrlsetdata($text, $hexvert) endselect wend exit Here's the issue... THE DAMN BUTTONS DON'T WORK!!! Do I have something wrong as far as anyone can see? Oh, here's the ignite.jpg if anyone wants it too... Edited July 20, 2006 by Paradox Link to comment Share on other sites More sharing options...
Paradox Posted July 20, 2006 Author Share Posted July 20, 2006 Okay, so after much contemplation and realizing that there is already a built in _stringtohex() and vice versa I rewrote it like so: expandcollapse popup#include <GUIConstants.au3> #include <string.au3> $extract=@scriptdir & "\ignite.jpg" fileinstall("E:\Projects\HexVert\ignite.jpg", $extract, 1) guicreate("HexVert by ParaDoX v1.0", 640, 480) guisetfont(11, 450) guictrlcreatepic("ignite.jpg", 0, 0, 640, 480) $text=guictrlcreateinput("", 90, 10, 530, 200) $hex=guictrlcreateinput("", 90, 240, 530, 200) guictrlcreatelabel("Txt :", 10, 10, 55, 17) guictrlcreatelabel("Hex :", 10, 240, 55, 17) $txt2hex=guictrlcreatebutton("txt2hex", 10, 30, 60, 20) $hex2txt=guictrlcreatebutton("hex2txt", 10, 260, 60, 20) guisetstate(@SW_SHOW) while 1 $msg = guigetmsg() select case $msg = $gui_event_close filedelete("ignite.jpg") exit case $msg = $txt2hex $convert=GUICtrlRead($text) $hexvert=_stringToHex($convert) guictrlsetdata($hex, $hexvert) case $msg = $hex2txt $convert=GUICtrlRead($hex) $hexvert=_hextostring($convert) guictrlsetdata($text, $hexvert) endselect wend exit Here's the issue... THE DAMN BUTTONS DON'T WORK!!! Do I have something wrong as far as anyone can see? Oh, here's the ignite.jpg if anyone wants it too... Update: If I take out the fileinstall for the image, it works perfectly. I'd LOVE to have the image work... Only things I need to do now is wordwrapping, and vertical scrolling. Link to comment Share on other sites More sharing options...
Paradox Posted July 20, 2006 Author Share Posted July 20, 2006 Update: If I take out the fileinstall for the image, it works perfectly. I'd LOVE to have the image work... Only things I need to do now is wordwrapping, and vertical scrolling. Dur, I'm a dumbass... here, updated, finished, and correct! expandcollapse popup; HexVert: ; Convert typed conversation to hex and back for encryption. ; ; ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <string.au3> $extract=@scriptdir & "\ignite.jpg" fileinstall("E:\Projects\HexVert\ignite.jpg", $extract, 1) guicreate("HexVert by ParaDoX v1.0", 640, 480) guisetfont(11, 450) guictrlcreatepic("ignite.jpg", 0, 0, 640, 480) GuiCtrlSetState(-1,$GUI_DISABLE) $text=guictrlcreateinput("", 90, 10, 530, 200, $ES_MULTILINE) $hex=guictrlcreateinput("", 90, 240, 530, 200, $ES_MULTILINE) guictrlcreatelabel("Txt :", 10, 10, 55, 17) guictrlcreatelabel("Hex :", 10, 240, 55, 17) $txt2hex=guictrlcreatebutton("txt2hex", 10, 30, 60, 20) $hex2txt=guictrlcreatebutton("hex2txt", 10, 260, 60, 20) guisetstate(@SW_SHOW) while 1 $msg = guigetmsg() select case $msg = $gui_event_close filedelete("ignite.jpg") exit case $msg = $txt2hex $convert=GUICtrlRead($text) $hexvert=_stringToHex($convert) guictrlsetdata($hex, $hexvert) case $msg = $hex2txt $convert=GUICtrlRead($hex) $hexvert=_hextostring($convert) guictrlsetdata($text, $hexvert) endselect wend exit get the image above or supply your own if you want. Have phun! Link to comment Share on other sites More sharing options...
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