Friday, July 08, 2022

[How To] Install CRC RevEng on macOS

CRC RevEng

CRC RevEng is a portable, arbitrary-precision CRC calculator and algorithm finder. It calculates CRCs using any 111 preset algorithms or a user-specified algorithm to any width. It calculates reversed CRCs to give the bit pattern that produces a desired forward CRC. CRC RevEng also reverse-engineers any CRC algorithm from good, correctly formatted message-CRC pairs and optional known parameters. It comprises powerful input interpretation options.

Installation instructions for macOS:

1. Download reveng from SourceForge:

2. Unzip the downloaded reveng zip file

3. % cd Downloads/reveng-3.0.3

4. % make

gcc -O3 -Wall -ansi -fomit-frame-pointer -DPRESETS -DBMPTST -o bmptst bmpbit.c

( ./bmptst && touch bmptst ) || ( rm bmptst bmptst.exe && false )

reveng: configuration fault.  Update config.h with these definitions and recompile:

#define BMP_BIT   64

#define BMP_SUB   32

rm: bmptst.exe: No such file or directory

make: *** [bmptst] Error 1

5. % gcc -O3 -Wall -ansi -c bmpbit.c cli.c model.c poly.c preset.c reveng.c

poly.c:150:19: warning: shifting a negative signed value is undefined [-Wshift-negative-value]

        int cmask = ~(~0 << CHAR_BIT), c;

                      ~~ ^

poly.c:215:19: warning: shifting a negative signed value is undefined [-Wshift-negative-value]

        int cmask = ~(~0 << CHAR_BIT), c;

                      ~~ ^

2 warnings generated.

6. % cd contrib

7. % gcc -O3 -Wall -ansi -c getopt.c

8. % cd ..

9. % gcc -o reveng bmpbit.o cli.o model.o poly.o preset.o reveng.o contrib/getopt.o

10. % ./reveng -h

CRC RevEng: arbitrary-precision CRC calculator and algorithm finder

Usage: ./reveng -cdDesvhu? [-1bBfFGlLMrStVXyz]

[-a BITS] [-A OBITS] [-i INIT] [-k KPOLY] [-m MODEL] [-p POLY]

[-p POLY] [-P RPOLY] [-q QPOLY] [-w WIDTH] [-x XOROUT] [STRING...]


-a BITS bits per character (1 to 64)

-A OBITS bits per output character (1 to 64)

-i INIT initial register value

-k KPOLY generator in Koopman notation (implies WIDTH)

-m MODEL preset CRC algorithm

-p POLY generator or search range start polynomial

-P RPOLY reversed generator polynomial (implies WIDTH)

-q QPOLY search range end polynomial

-w WIDTH register size, in bits

-x XOROUT final register XOR value

Modifier switches:

-1 skip equivalent forms -b big-endian CRC

-B big-endian CRC output -f read files named in STRINGs

-F skip preset model check pass -G skip brute force search pass

-l little-endian CRC -L little-endian CRC output

-M non-augmenting algorithm -r right-justified output

-S print spaces between chars -t left-justified output

-V reverse algorithm only -X print uppercase hexadecimal

-y low bytes first in files -z raw binary STRINGs

Mode switches:

-c calculate CRCs -d dump algorithm parameters

-D list preset algorithms -e echo (and reformat) input

-s search for algorithm -v calculate reversed CRCs

-h | -u | -? show this help

Copyright (C) 2010, 2011, 2012, 2013, 2014,

      2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022  Gregory Cook

This is free software; see the source for copying conditions.  There is NO


Version 3.0.3   <>

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.