Skitty Posted March 24, 2011 Posted March 24, 2011 (edited) #include<Crypt.au3> _Crypt_Startup() $Y = _Crypt_HashData("TrojanDwnloader.32", $CALG_MD5) _Crypt_Shutdown() If Not ( $Y <> "0x0E08BBFAB6D554CFBEB79DBCC3A3D740" ) Then MsgBox(0,"Test: 1","Success.") If Not ( $Y <> "»ú¶ÕTÏŸ·ŒÃ£×@" ) Then MsgBox(0,"Test: 2","Success.")EDIT: didn't realize that the binary string matches anything...Never mind that, I used another similar word that came up with a match but now I cant remember it and nothing elseseem's to match the binary string again, other than "TrojanDwnloader.32"why? Edited March 24, 2011 by System238
Moderators Melba23 Posted March 24, 2011 Moderators Posted March 24, 2011 System238, Why do both strings match up?Because they are the same? Actually for me the second does not match - here is why: Test 1: You are comparing a number to a number - so your convoluted statement works like this: On my machine $Y = 0x0E08BBFAB6D554CFBEB79DBCC3A3D740 And so If Not ( $Y <> "0x0E08BBFAB6D554CFBEB79DBCC3A3D740" ) Then If Not ( False ) ; because they match If True ; So you get a match Test 2: You are comparing a anumber to a string - so all will depend on how your number is converted into a string: On my machine BinaryToString($Y) = »ú¶ÕTϾ·¼Ã£×@ Which is not »ú¶ÕTÏŸ·ŒÃ£×@ And so If Not ( $Y <> "»ú¶ÕTÏŸ·ŒÃ£×@" ) Then If Not ( True ) ; because they do not match If False ; So you do not get a match I imagine it has to do with the type of coding and the character set you are using - well beyond me I am afraid. I would just stick to the number:number comparison if I were you. And why on earth are you using a Not ( <> ) construction? What is wrong with If ( = )? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
jvanegmond Posted March 24, 2011 Posted March 24, 2011 (edited) And note the SO BS characters.. (Bad pun?)Best way IMO:If Not ( $Y <> Binary("0x0E08BBFAB6D554CFBEB79DBCC3A3D740") ) Then MsgBox(0,"Test: 1","Success.")I'm guessing that Melbas suggested approach uses string comparison while this compares binary. If there happens conversions of strings to binary first, then this method is still better because the conversion only happens once. Edited March 24, 2011 by Manadar github.com/jvanegmond
AdmiralAlkex Posted March 24, 2011 Posted March 24, 2011 And note the SO BS characters.. (Bad pun?)I lol'd .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
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