bilibili2011 Posted October 21, 2014 Share Posted October 21, 2014 Hi everybody, i need to calculate crc16 checksum from an hex string, i have only found one string version here: '?do=embed' frameborder='0' data-embedContent>> I have done all my possible to edit it to give me good results but it doesn't work. For example, go to this website: http://www.lammertbies.nl/comm/info/crc-calculation.html and enter any hex value, it will give you the crc16 but i want the hex version, so click the hex button and it will give you different result and it is what i want. So please help me, thanks Link to comment Share on other sites More sharing options...
step887 Posted October 21, 2014 Share Posted October 21, 2014 '?do=embed' frameborder='0' data-embedContent>> #Include "CRC.au3" Dim $CRC16 = _CRC16('123456789') MsgBox(0, 'CRC16', '0x' & Hex($CRC16, 4)) Link to comment Share on other sites More sharing options...
bilibili2011 Posted October 21, 2014 Author Share Posted October 21, 2014 '?do=embed' frameborder='0' data-embedContent>> #Include "CRC.au3" Dim $CRC16 = _CRC16('123456789') MsgBox(0, 'CRC16', '0x' & Hex($CRC16, 4)) It doesn't give me the values i was waiting, i have given an example in my first post, the script of Ward takes the values as an ascii string. Link to comment Share on other sites More sharing options...
bilibili2011 Posted October 25, 2014 Author Share Posted October 25, 2014 Nobody can help me ? Link to comment Share on other sites More sharing options...
Solution jchd Posted October 26, 2014 Solution Share Posted October 26, 2014 You just need to convert your input string in ASCII hex to binary. #Include "CRC.au3" ; 46 random bytes as hex string Local $sHex = "1E26E646AD1CD374F41B3780A88FD5E2D757AD3FE03F4761298D351730464920DE0AFF91C420E062AC84FC1B0C3F" ; convert it to binary then compute the CRC Local $bCRC = _CRC16(Binary("0x" & $sHex)) ConsoleWrite(Hex($bCRC, 4) & @LF) bilibili2011 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
bilibili2011 Posted October 26, 2014 Author Share Posted October 26, 2014 Thank you very much jchd, it works. I have tried similar edits on the script but not the good one. 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