Ward Posted July 28, 2008 Share Posted July 28, 2008 (edited) 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. Here are MD5, SHA1, CRC32, RC4, and BASE64 algorithm in the attachment. (My CRC32 Code is a bit faster then Lazycat's version)SHA1_MD5_RC4_BASE64_CRC32.zipIf someone needs other algorithm, please let me know, and I will try my best.If you are looking for SHA2 or AES, here and here. 2008/08/02 Update Note:Corrected Block TEA (XXTEA) block cipher is added. Take a look at Wikipedia for detail.SHA1_MD5_RC4_BASE64_CRC32_XXTEA.zip2008/08/24 Update Note:Add a parameter $LineBreak to _Base64Encode(). This function will break output line in every 76 characters by default. Thanks to trancexx.SHA1_MD5_RC4_BASE64_CRC32_XXTEA.zip2008/09/27 Update Note:Optimize machine code in _Base64Encode() and _Base64Decode().Fix _Base64Encode() crash problem. Thanks to trancexx.SHA1_MD5_RC4_BASE64_CRC32_XXTEA.zip Edited November 23, 2015 by Ward oapjr 1 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
spyrorocks Posted July 28, 2008 Share Posted July 28, 2008 VERY nice. This will come in very handy to me. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
wraithdu Posted July 29, 2008 Share Posted July 29, 2008 Very nice! Link to comment Share on other sites More sharing options...
rasim Posted July 29, 2008 Share Posted July 29, 2008 WardVery useful! Thank you! Link to comment Share on other sites More sharing options...
Lazycat Posted July 29, 2008 Share Posted July 29, 2008 Thanks fot this things done, especially for MD5 and BASE64! Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
JRSmile Posted July 29, 2008 Share Posted July 29, 2008 Marvelous. *thumbs up* $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
tehhahn Posted July 29, 2008 Share Posted July 29, 2008 Great functions, Ward! Thank you very much! I have one question: The Base64 and the RC4 functions do return the same hashes. I am not an expert and do not have very much knowledge about cryptography, but is that correct? Do Base64 and RC4 base on the same algorithm, or what? Some more algorithms you (maybe) want to implement: "MD2", "MD4", "SHA256", "SHA384", "SHA512", "HAVAL128", "HAVAL160", "HAVAL192", "HAVAL224", "HAVAL256", "GHOST", "TIGER128", "TIGER160", "TIGER192", "RIPE-MD128", "RIPE-MD160", "CRC16", "ARC-CRC" Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted July 29, 2008 Share Posted July 29, 2008 Thanks for this Ward, I have been playing with translating a lot of these functions to regular AutoIt Code, but this solution is faster, and works just as well. I may continue playing with mine just to learn how they all work on the inside.As a reference, the sourceforge project rehash has all the hashing algorithms you posted, as well as several other good ones, in C++ code, for you to look at. Wasn't sure how the brand of C you used would compare with these, but from what I've seen of the code, it should be very easy to translate it and use it for similar purposes. Link to comment Share on other sites More sharing options...
arcker Posted July 29, 2008 Share Posted July 29, 2008 oh man was dreaming of it. How did you get the machine code version ? -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
ptrex Posted July 31, 2008 Share Posted July 31, 2008 @Ward This is REAAAALLY fast !! Very nice. Thanks regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted July 31, 2008 Share Posted July 31, 2008 That's just awesome. The functions are amazingly small too. Maybe you could implement more algorithms just for fun (suggested by tehhahn, and SkinnyWhiteGuy) ? Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
Ward Posted August 2, 2008 Author Share Posted August 2, 2008 Great functions, Ward! Thank you very much!I have one question: The Base64 and the RC4 functions do return the same hashes. I am not an expert and do not have very much knowledge about cryptography, but is that correct? Do Base64 and RC4 base on the same algorithm, or what?What did you mean "return the same hashes"?Base64 and RC4 have different functions. Base64 is an scheme to encode binary data to ASCII string, however, RC4 is a stream chiper to encrypt your data with a private key. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
Ward Posted August 2, 2008 Author Share Posted August 2, 2008 oh man was dreaming of it. How did you get the machine code version ?You can find a lot of source code in C about these algorithm, but almost all of them need some modifications to be used. The biggest problem is you can't use the static reference. So some assembly knowledge is very helpful. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
smartee Posted August 2, 2008 Share Posted August 2, 2008 nice script and all but how can i make a standalone app to check its own MD5? Link to comment Share on other sites More sharing options...
Ward Posted August 3, 2008 Author Share Posted August 3, 2008 nice script and all but how can i make a standalone app to check its own MD5?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. 新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了。 Link to comment Share on other sites More sharing options...
mikeytown2 Posted August 3, 2008 Share Posted August 3, 2008 Sweet Code!!!Using the old Base64 code it took 6.344 seconds to encode a 1.3mb file on my computer. Using this it took 0.092 seconds. Well done! Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
slayerz Posted August 4, 2008 Share Posted August 4, 2008 Good job Ward, it' really fast. Thanks 4 sharing AUTOIT[sup] I'm lovin' it![/sup] Link to comment Share on other sites More sharing options...
spyrorocks Posted August 6, 2008 Share Posted August 6, 2008 (edited) Is it just me, or do some of these functions like sha1 crash on windows server 2003? EDIT: Yes, I am right, they all crash on windows server 2003. Tested using current release of autoit and tested using newest beta, they all crash. WARD, or someone else with access to server 2003, id really appreciate it if you could fix this. Edited August 6, 2008 by spyrorocks [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
arcker Posted August 6, 2008 Share Posted August 6, 2008 it takes the machine code from a compiled C-- program. C-- is an old language so maybe the machine code generated can't be interpreted by win2003 and more. -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
SxyfrG Posted August 7, 2008 Share Posted August 7, 2008 This is uber awesome Ward! You know what would be an awesome addition? Some more encryption algo's AES-256 (rijndael), Blowfish, Triple DES and any others you feel comfortable getting the machine code for My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website 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