InvertedTomato.Crc 1.3.6

dotnet add package InvertedTomato.Crc --version 1.3.6
NuGet\Install-Package InvertedTomato.Crc -Version 1.3.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InvertedTomato.Crc" Version="1.3.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InvertedTomato.Crc --version 1.3.6
#r "nuget: InvertedTomato.Crc, 1.3.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install InvertedTomato.Crc as a Cake Addin
#addin nuget:?package=InvertedTomato.Crc&version=1.3.6

// Install InvertedTomato.Crc as a Cake Tool
#tool nuget:?package=InvertedTomato.Crc&version=1.3.6


TLDR; How do I make it go?

// Create a new instance of Crc using the algorithm of your choice
var crc = CrcAlgorithm.CreateCrc16CcittFalse();

// Give it some bytes to chew on - you can call this multiple times if needed
crc.Append(Encoding.ASCII.GetBytes("Hurray for cake!"));

// Get the output - as a hex string, byte array or unsigned integer


CRC is an interesting standard. It's an interesting standard, because it isn't really a standard at all. It seems rather better to be considered an idea. Many people have taken that core idea of CRC and implemented it in many different ways. At the time of writing Wikipedia lists 61 different implementations. There are even tools available that support over 100 implementations.

Each of these implementations (or algorithms, as they're more commonly known) differ in the following ways:

  • They vary in the width, or the size of the outputted hash.
  • The use different underlying polynomials.
  • The algorithms are seeded with differing initial values.
  • Some reflect the input before processing it
  • Some reflect the output before returning it
  • Some apply a XOR to the output return it

(This is taken straight from the fantastic work of Ross N. Williams and I take no credit.)

InvertedTomato.Crc takes into account all of these parameters allowing it to be customised to the particular algorithm you need.

Supported algorithms

InvertedTomato.Crc allows you to plug any parameters you'd like into the constructor to support any algorithm you'd like (so long as it's width is 8-64bits), however I've included some of the most common algorithms for convenience borrowed from Meetantony.

Algorithm Generator
CRC-8 CrcAlgorithm.CreateCrc8()
CRC-8/CDMA2000 CrcAlgorithm.CreateCrc8Cdma2000()
CRC-8/DARC CrcAlgorithm.CreateCƒrc8Darc()
CRC-8/DVB-S2 CrcAlgorithm.CreateCrc8DvbS2()
CRC-8/EBU CrcAlgorithm.CreateCrc8Ebu()
CRC-8/I-CODE CrcAlgorithm.CreateCrc8ICode()
CRC-8/ITU CrcAlgorithm.CreateCrc8Itu()
CRC-8/MAXIM CrcAlgorithm.CreateCrc8Maxim()
CRC-8/ROHC CrcAlgorithm.CreateCrc8Rohc()
CRC-8/WCDMA CrcAlgorithm.CreateCrc8Wcdma()
CRC-16/CCITT-FALSE CrcAlgorithm.CreateCrc16CcittFalse()
CRC-16/ARC CrcAlgorithm.CreateCrc16Arc()
CRC-16/AUG-CCITT CrcAlgorithm.CreateCrc16AugCcitt()
CRC-16/BUYPASS CrcAlgorithm.CreateCrc16Buypass()
CRC-16/CDMA2000 CrcAlgorithm.CreateCrc16Cdma2000()
CRC-16/DDS-110 CrcAlgorithm.CreateCrc16Dds110()
CRC-16/DECT-R CrcAlgorithm.CreateCrc16DectR()
CRC-16/DECT-X CrcAlgorithm.CreateCrc16DectX()
CRC-16/DNP CrcAlgorithm.CreateCrc16Dnp()
CRC-16/EN-13757 CrcAlgorithm.CreateCrc16En13757()
CRC-16/GENIBUS CrcAlgorithm.CreateCrc16Genibus()
CRC-16/MAXIM CrcAlgorithm.CreateCrc16Maxim()
CRC-16/MCRF4XX CrcAlgorithm.CreateCrc16Mcrf4Xx()
CRC-16/RIELLO CrcAlgorithm.CreateCrc16Riello()
CRC-16/T10-DIF CrcAlgorithm.CreateCrc16T10Dif()
CRC-16/TELEDISK CrcAlgorithm.CreateCrc16Teledisk()
CRC-16/TMS37157 CrcAlgorithm.CreateCrc16Tms37157()
CRC-16/USB CrcAlgorithm.CreateCrc16Usb()
CRC-A CrcAlgorithm.CreateCrcA()
CRC-16/KERMIT CrcAlgorithm.CreateCrc16Kermit()
CRC-16/MODBUS CrcAlgorithm.CreateCrc16Modbus()
CRC-16/X-25 CrcAlgorithm.CreateCrc16X25()
CRC-16/XMODEM CrcAlgorithm.CreateCrc16Xmodem()
CRC-24 CrcAlgorithm.CreateCrc24()
CRC-24/FLEXRAY-A CrcAlgorithm.CreateCrc24FlexrayA()
CRC-24/FLEXRAY-B CrcAlgorithm.CreateCrc24FlexrayB()
CRC-32 CrcAlgorithm.CreateCrc32()
CRC-32/BZIP2 CrcAlgorithm.CreateCrc32Bzip2()
CRC-32C CrcAlgorithm.CreateCrc32C()
CRC-32D CrcAlgorithm.CreateCrc32D()
CRC-32/JAMCRC CrcAlgorithm.CreateCrc32Jamcrc()
CRC-32/MPEG-2 CrcAlgorithm.CreateCrc32Mpeg2()
CRC-32/POSIX CrcAlgorithm.CreateCrc32Posix()
CRC-32Q CrcAlgorithm.CreateCrc32Q()
CRC-32/XFER CrcAlgorithm.CreateCrc32Xfer()
CRC-40/GSM CrcAlgorithm.CreateCrc40Gsm()
CRC-64 CrcAlgorithm.CreateCrc64()
CRC-64/WE CrcAlgorithm.CreateCrc64We()
CRC-64/XZ CrcAlgorithm.CreateCrc64Xz()

Further reading

If you're keen to know more about CRC, I can't over-recommend Ross N. Williams's 'A Painless Guide ot CRC Error Detection Algorithms. I haven't been able to find the original URL of it though, so I've mirrored it here.

Where do I get it from?

You can find it on NuGet.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.0 is compatible.  netstandard1.1 was computed.  netstandard1.2 was computed.  netstandard1.3 was computed.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Windows Phone wp8 was computed.  wp81 was computed.  wpa81 was computed. 
Windows Store netcore was computed.  netcore45 was computed.  netcore451 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 1.0

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on InvertedTomato.Crc:

Repository Stars
Open source re-implementation of The Sims 2 in Unity
Version Downloads Last updated
1.3.6 2,050 7/31/2023
1.3.4 229 7/9/2023
1.3.3 129 7/8/2023
1.3.0 941 4/4/2023
1.2.0 6,788 7/13/2022
1.1.3 21,550 9/25/2019
1.1.2 1,173 2/2/2019
1.1.1 616 2/2/2019
1.1.0 601 2/2/2019
1.0.2 639 2/1/2019

Made signing more compatible