ancp Posted February 22, 2009 Share Posted February 22, 2009 Fantastic! CRC32 is really very fast! Many many thanks to Lazycat and Ward! Please, would it be possible to create the function for calculate CRC8 (8-bit)? Link to comment Share on other sites More sharing options...
jennico Posted March 1, 2009 Share Posted March 1, 2009 brilliant ! thank you !!! ***** j. Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96 Link to comment Share on other sites More sharing options...
pDanil2006 Posted March 8, 2009 Share Posted March 8, 2009 so... I get md5 with help this UDF and with other software. hashs: AutoIT UDF 0x3c0b27e96a095d9d4494ef9e531c1e45 Olther program: 3c0b27e96a095d9d4494ef9e531c1e45 What is 0x? How remove it from hash result? Link to comment Share on other sites More sharing options...
Authenticity Posted March 8, 2009 Share Posted March 8, 2009 (edited) StringTrimLeft by 2 characters I believe.Edit: It's for the Binary functions to indicate a binary string. Edited March 8, 2009 by Authenticity Link to comment Share on other sites More sharing options...
pDanil2006 Posted March 8, 2009 Share Posted March 8, 2009 Can you write code? Link to comment Share on other sites More sharing options...
trancexx Posted March 8, 2009 Share Posted March 8, 2009 $MD5 = Hex($MD5) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
rajeshontheweb Posted March 11, 2009 Share Posted March 11, 2009 i have found this utility very very useful, mates. i had used MD5File.exe and similar utiilties earlier and used batch scripting etc to struggle deleting viruses in my network . this was very useful but i have one suggestion. i am using this algorithm but i got lost some time ago. i had a tough time to find u to thank you. because ur script MD5.au3 doesnt have author info :-( can u add a couple of lines of author info so that it would be very very useful. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
Armand Posted March 13, 2009 Share Posted March 13, 2009 @KaFu Mate, As my comment was mentioning ... don't let the DLLCall run on empty data and that's all! [u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?! Link to comment Share on other sites More sharing options...
KaFu Posted March 13, 2009 Share Posted March 13, 2009 don't let the DLLCall run on empty data and that's all!Right, now I've read it ... nevertheless I myself ran into problems trying to obfuscate the code... which can be resolved with the method I mentioned , just didn't want to let this tip go to waste.Best Regards OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Jango Posted March 16, 2009 Share Posted March 16, 2009 Thanks to Lazycat's great idea. He told us how to use the CallWindowProc API to run machine code.So I wrote some codes in Sphinx C--, and run them in AutoIt.Hello,Can you provide a link to get the Sphinx C-- compiler ? i can't find it doing search with google ... Link to comment Share on other sites More sharing options...
Ward Posted March 20, 2009 Author Share Posted March 20, 2009 Hello,Can you provide a link to get the Sphinx C-- compiler ? i can't find it doing search with google ...http://c--sphinx.narod.ru/indexe.htm 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
ynbIpb Posted May 19, 2009 Share Posted May 19, 2009 You can add the MD5 hash to the end of the exe. When you check the hash, omit the last 16 bytes.If you worry about it is too easy to be broken, maybe RC4 or XXTEA can be use to encrypt the hash.Please show an example on how to implement it, given that the file can be of large size. Thank you. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 19, 2009 Moderators Share Posted May 19, 2009 (edited) ynbIpb, First take an .exe file - it will not be changed by the script, but I would use a copy if I were you! :-) Then run this code - you will have to amend the file paths and names to suit your system:#include <md5.au3> Global $iBufferSize = 0x20000 $sFilename = "M:\Program\Au3 Scripts\HashTest.exe" $iRemaining = FileGetSize($sFilename) Global $hFileHandle = FileOpen($sFilename, 16) $iTotal = 0 $MD5CTX = _MD5Init() For $i = 1 To Ceiling($iRemaining / $iBufferSize) If $iRemaining > $iBufferSize Then _MD5Input($MD5CTX, FileRead($hFileHandle, $iBufferSize)) $iRemaining -= $iBufferSize $iTotal += $iBufferSize Else _MD5Input($MD5CTX, FileRead($hFileHandle, $iRemaining)) $iTotal += $iRemaining EndIf Next $vHash = _MD5Result($MD5CTX) $sOrg_File_Contents = FileRead($sFilename) FileClose($hFileHandle) $hFileHandle = FileOpen("M:\Program\Au3 Scripts\HashAdded.exe", 18) FileWrite($hFileHandle, $sOrg_File_Contents & StringTrimLeft($vHash , 2)) FileClose($hFileHandle) MsgBox(0,"Hash",$vHash) You should now have 2 .exe files, one 32 bytes bigger than the other because of the added hash. Now run this code. Again you should amend the file paths and names to suit your system:expandcollapse popup#include <md5.au3> #Include <String.au3> #include <WinAPI.au3> Global $iBufferSize = 0x20000 ; Org file $sFilename = "M:\Program\Au3 Scripts\HashTest.exe" $iRemaining = FileGetSize($sFilename) Global $hFileHandle = FileOpen($sFilename, 16) $iTotal = 0 $MD5CTX = _MD5Init() For $i = 1 To Ceiling($iRemaining / $iBufferSize) If $iRemaining > $iBufferSize Then _MD5Input($MD5CTX, FileRead($hFileHandle, $iBufferSize)) $iRemaining -= $iBufferSize $iTotal += $iBufferSize Else _MD5Input($MD5CTX, FileRead($hFileHandle, $iRemaining)) $iTotal += $iRemaining EndIf Next $vHash1 = _MD5Result($MD5CTX) FileClose($hFileHandle) ConsoleWrite("Original file total bytes read : " & $iTotal & @CRLF) ; File with 32 byte hash added to end $sFilename = "M:\Program\Au3 Scripts\HashAdded.exe" $iRemaining = FileGetSize($sFilename) - 32 Global $hFileHandle = FileOpen($sFilename, 16) $iTotal = 0 $MD5CTX = _MD5Init() For $i = 1 To Ceiling($iRemaining / $iBufferSize) If $iRemaining > $iBufferSize Then _MD5Input($MD5CTX, FileRead($hFileHandle, $iBufferSize)) $iRemaining -= $iBufferSize $iTotal += $iBufferSize Else _MD5Input($MD5CTX, FileRead($hFileHandle, $iRemaining)) $iTotal += $iRemaining EndIf Next $vHash2 = _MD5Result($MD5CTX) FileClose($hFileHandle) ConsoleWrite("Exe less added hash total bytes read: " & $iTotal & @CRLF) ; Now read original hash added to the file $iRemaining = FileGetSize($sFilename) Global $hFileHandle = FileOpen($sFilename, 16) $iTotal = 0 For $i = 1 To Ceiling($iRemaining / $iBufferSize) If $iRemaining > $iBufferSize Then FileRead($hFileHandle, $iBufferSize) $iRemaining -= $iBufferSize $iTotal += $iBufferSize Else $sHash_Section = FileRead($hFileHandle, $iRemaining) $iTotal += $iRemaining EndIf Next FileClose($hFileHandle) ConsoleWrite("Exe with added hash total bytes read: " & $iTotal & @CRLF) $sHash_Bytes = StringRight($sHash_Section, 64) $sHash_Chars = "" For $i = 1 To 64 Step 2 $sHash_Chars &= Chr(Dec(StringMid($sHash_Bytes, $i, 2))) Next ; Or use Win_API functions Global $nBytes $iRemaining = FileGetSize($sFilename) $tBuffer = DllStructCreate("byte[32]") $hFile = _WinAPI_CreateFile($sFilename, 2, 2) _WinAPI_SetFilePointer($hFile, $iRemaining - 32) _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 32, $nBytes) _WinAPI_CloseHandle($hFile) $sHash_API = BinaryToString(DllStructGetData($tBuffer, 1)) MsgBox(0, "Hashes", $vHash1 & @CRLF & $vHash2 & @CRLF & "0x" & $sHash_Chars & @CRLF & "0x" & $sHash_API) The final MsgBox gives me 4 identical hashes - for the original file, for the new file once stripped of the added hash, and the twice the actual hash that was added to the new file. All 4 match the hash that was shown at the end of the first script. I hope you find this useful. M23 Edit 1: Changed second script so the whole file does not have to be read into memory to get at the added hash - as requested by ynbIpb. :-) Edit 2: Added the Win API method as suggested by crashdemons. Edited May 20, 2009 by Melba23 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 Link to comment Share on other sites More sharing options...
ynbIpb Posted May 19, 2009 Share Posted May 19, 2009 Thank you for the example. But now I wonder: ; Now read original hash added to the file$sContents_Plus_Hash = FileRead($hFileHandle)$sHash_Bytes = StringRight($sContents_Plus_Hash, 64)This step reads the whole file in memory? and if my file is very big? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 19, 2009 Moderators Share Posted May 19, 2009 (edited) ynbIpb,If you are concerned about the size of the file, then use a similar trick to that used in the code to hash the files. Set a $iBufferSize variable and read the file in sections until you get to the last section which includes the hash. I am sure you can code that for yourself! ;-)M23Edit: But if you do not want to I have amended the example above. :-) Edited May 19, 2009 by Melba23 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 Link to comment Share on other sites More sharing options...
ynbIpb Posted May 19, 2009 Share Posted May 19, 2009 thank you very much! I will try ... Link to comment Share on other sites More sharing options...
crashdemons Posted May 19, 2009 Share Posted May 19, 2009 ynbIpb,If you are concerned about the size of the file, then use a similar trick to that used in the code to hash the files. Set a $iBufferSize variable and read the file in sections until you get to the last section which includes the hash. I am sure you can code that for yourself! ;-)If you use _WinAPI_SetFilePointer you can read/write data from specific positions in a file, instead of starting at the first character.See the _WinAPI_SetFilePointer examples in the Help File. My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 20, 2009 Moderators Share Posted May 20, 2009 crashdemons, Thanks for that memory jog - completely forgot about the API call. I have added code for it to the example above. 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 Link to comment Share on other sites More sharing options...
crashdemons Posted May 24, 2009 Share Posted May 24, 2009 (edited) Not to be picky, but can this line be removed from _MD5Init() and _MD5Result() $CodeBuffer = 0 $Codebuffer is only actually used, locally, in _MD5() Depending upon Au3Check settings, both of these can generate 2 warnings: ...\MD5.au3(21,17) : WARNING: $CodeBuffer possibly not declared/created yet $CodeBuffer = 0 ~~~~~~~~~~~~~~~^ ...\MD5.au3(21,17) : WARNING: $CodeBuffer: declared, but not used in func. $CodeBuffer = 0 ~~~~~~~~~~~~~~~^ ...\MD5.au3(58,17) : WARNING: $CodeBuffer possibly not declared/created yet $CodeBuffer = 0 ~~~~~~~~~~~~~~~^ ...\MD5.au3(58,17) : WARNING: $CodeBuffer: declared, but not used in func. $CodeBuffer = 0 ~~~~~~~~~~~~~~~^ These issues aren't really critical and you can handle them how you like, if you like - I thought I'd just point them out. Edited May 24, 2009 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.) Link to comment Share on other sites More sharing options...
nht3004 Posted May 27, 2009 Share Posted May 27, 2009 Really nice, now I get a way to interact between Web browser and AutoIT for(loop=0; loop<infinity; loop++) { alert('I love you'); } 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