Skip to main content

A tool to find well known crc params that matches the input data and crc result (right or wrong)

Project description

CrcFinder

A tool to find well known crc params that matches the input data and crc result (right or wrong)

Install

pip install crcFinder

Usage

As Library

find zlib.crc32

from crcFinder import CrcFinder
import zlib

data = []
data.append((b"123456789", zlib.crc32(b'123456789')))
data.append((b"123456789xxxx", zlib.crc32(b'123456789xxxx')))
f = CrcFinder()
r = f.findCrc(data)
print([str(i) for i in r])

find something else

from crcFinder import CrcFinder
data = []
data.append((b"123456789\x09", b'\x11\x60\x7a\x37'))
data.append((b"1234567890\x0a", b'\xb3\x95\xcb\x46'))
f = CrcFinder()
r = f.findCrc(data)
print(r[0])

use CrcCalculator directly

from crcFinder import CrcCalculator, ShiftType
crc_pkzip = CrcCalculator(32, 0x04c11db7, 0xffffffff, True, True, 0xffffffff, ShiftType.LEFT, ShiftType.LEFT)
assert(crc_pkzip.check() == 0xcbf43926)

Solver

see tests/test_Solver.py

cli

# find crc poly and other params
python -m crcFinder find -d 616263646566,4b8e39ef
python -m crcFinder find -d 616263646566,0x4b8e39ef 313233343536373839,0xcbf43926
# calculate data crc
python -m crcFinder calculate --params "width=32 poly=0x04c11db7 init=0xffffffff refin=True refout=True xorout=0xffffffff check=0xcbf43926 name=None tableGenShiftType:ShiftType.LEFT calcShiftType:ShiftType.LEFT extra=None" -d 313233343536373839
# generate a padding to data for specified crc checksum value
python -m crcFinder solve --params "width=32 poly=0x04c11db7 init=0xffffffff refin=True refout=True xorout=0xffffffff check=0xcbf43926 name=None tableGenShiftType:ShiftType.LEFT calcShiftType:ShiftType.LEFT extra=None" --data 68656c6c6f --target 0x12345678

Reference

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crcfinder-0.0.4.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crcfinder-0.0.4-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file crcfinder-0.0.4.tar.gz.

File metadata

  • Download URL: crcfinder-0.0.4.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for crcfinder-0.0.4.tar.gz
Algorithm Hash digest
SHA256 76ae50f3e531fcf8d2ae16959ae66962344bc402bc695ba1294e40fba4e44b11
MD5 75e6d0bcb0e522decd240bf0b3913dc8
BLAKE2b-256 01ea4058161904050d196906d8b3ad5bb58e62777ec62799978b3eaa4f0b2fb7

See more details on using hashes here.

File details

Details for the file crcfinder-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: crcfinder-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for crcfinder-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0e515d9136e087f7cbbc91b4187d19234b8f82b0e84caa6d2c925649cfa3c769
MD5 dd9bfc004fe28c3972ccb1999e706851
BLAKE2b-256 a67ab8187065155853a311271a35bfd4e891925935f29fc9f3b5ff6b3b2180f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page