Simple Python CRC implementation for playing around with cyclic redundancy checks, for instance when analyzing undocumented protocols or file formats.
Inspired by
- Online CRC Calculator by Anton Isakov
- Sunshine2k's CRC Calculator by Bastian Molkenthin
Caution: This simple Python implementation is not very fast, but it may be good enough for some test cases. If search spaces are quite large and/or more speed is required, consider using other CRC tools like bruteforce-crc.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from syss_crc import CRC
# main
if __name__ == "__main__":
# simple usage example
crc = CRC()
crc.set_config_by_name("CRC-32")
data = b"What's my CRC again?"
c = crc.compute(data)
print("[*] CRC-32 of test data '{:s}' is {:X}".format(data.decode("UTF-8"), c))
Use at your own risk. Mainly for educational and tinkering purposes.