Skip to content

Cheat Sheet

Johann N. Löfflmann edited this page Sep 11, 2021 · 25 revisions

The cheat sheet covers both the Command Line Interface (CLI) and the Java API (Application Programming Interface).

Get information

How to get all available algorithms

CLI

jacksum --info

or

jacksum -a all --list

API

Map<String, String> availableAlgorithms = JacksumAPI.getAvailableAlgorithms();

See also

Get application/lib version

CLI

jacksum --version

API

JacksumAPI.VERSION;

or

Version version = JacksumAPI.getVersion();

or

String versionString = JacksumAPI.getVersionString();

See also

Find the algorithm to a hash value

CLI

jacksum -a unknown:16 -q hex:050000 -E hex -e d893

Finds all algorithms with a digest width of 16 bits that produces the hex output d893 for the hex input 050000.

Result
Trying 13 algorithms with a width of 16 bits that are supported by Jacksum 3.0.0 ...

Trying 30 CRC algorithms with a width of 16 bits by testing against well known CRCs ...
crc:16,1021,FFFF,false,false,FFFF
    --> CRC-16/GENIBUS

Trying all CRC algorithms with a width of 16 bits by brute force (be patient!) ...
crc:16,1021,FFFF,false,false,FFFF
crc:16,37D2,FFFF,true,false,FFFF
crc:16,3E2D,0000,true,false,FFFF
crc:16,4175,FFFF,true,false,FFFF
crc:16,4A5B,FFFF,true,true,0000
crc:16,5A41,FFFF,true,false,FFFF
crc:16,5C63,FFFF,true,true,0000
crc:16,6287,FFFF,true,true,0000
crc:16,649C,0000,false,true,FFFF
crc:16,6D55,FFFF,true,true,0000
crc:16,75AC,FFFF,true,false,FFFF
crc:16,7D64,FFFF,false,false,FFFF
crc:16,81A6,FFFF,true,false,FFFF
crc:16,B9F9,FFFF,true,true,0000
crc:16,C3D6,FFFF,false,false,FFFF
crc:16,D436,0000,true,false,FFFF
crc:16,D6D2,0000,false,true,FFFF
crc:16,DA9C,FFFF,true,false,FFFF
crc:16,E03E,FFFF,false,false,FFFF
crc:16,F701,FFFF,true,false,FFFF


Jacksum: algorithms tested: 1048620
Jacksum: algorithms found: 21

Jacksum: elapsed time: 6 s, 460 ms

Means Jacksum has tested more than one million algorithms in about 7 seconds and it found 21 matching algorithms. Each of those returns the same CRC value. Test with more input/output sequences and/or longer input sequences in order to find the right algorithm. The most likely algorithm is printed with a name if it is a well known CRC. In this example it has been identified as the CRC-16/GENIBUS.

Once you have identified the correct algorithm, you can calculate your own input data using the CRC definitions that have been found.

jacksum -a crc:16,1021,FFFF,false,false,FFFF -E hex -q txt:"Hello World"
Clone this wiki locally