Saturday, December 3, 2016

Reverse Engineering CRCs?

I was working on deciphering a lot of communication protocols lately and I had to write several tedious Python-based brute-force algorithms. Within minutes, I soon realised that it is beyond me to do it. Since I am not an expert in error detection, I had to try to google it to see if someone else that are clever than me already done the same thing.

Then I found this post:
http://stackoverflow.com/questions/18890771/crc-craking-knowing-result 


I decided to give it go by downloading it from here:
https://sourceforge.net/projects/reveng/


I then proceeded to test it by key-in "reveng -w 16 -s 9876543210B283 01234567896282" in the shell to test for packet 9876543210B283 and 01234567896282 with xmodem.




I generate the CRC from here:
https://www.lammertbies.nl/comm/info/crc-calculation.html

To run the program, simply open command prompt in the same directory as reveng.exe (I did it by Shift+Right Click in Windows).
The result is:

As you can see, RevEng successfully reverse engineered the given packets!

Many thanks to Mark Adler for introducing me to RevEng and Greg Cook for creating it!