NullFX.CRC
1.1.7
See the version list below for details.
dotnet add package NullFX.CRC --version 1.1.7
NuGet\Install-Package NullFX.CRC -Version 1.1.7
<PackageReference Include="NullFX.CRC" Version="1.1.7" />
paket add NullFX.CRC --version 1.1.7
#r "nuget: NullFX.CRC, 1.1.7"
// Install NullFX.CRC as a Cake Addin #addin nuget:?package=NullFX.CRC&version=1.1.7 // Install NullFX.CRC as a Cake Tool #tool nuget:?package=NullFX.CRC&version=1.1.7
NullFX CRC
NullFX CRC is a small set of CRC utilities written in native C# released under the MIT License
NuGet:
Install
dotnet add PROJECT package NullFX.CRC --version 1.1.7
Examples:
Each CRC library uses a common ComputeChecksum
format. It accepts a byte array which can be obtained by converting text / numbers / structures etc into an array, then passing the byte array into ComputeChecksum
for it's CRC.
The ComputeChecksum
method also has a params
argument parameter allowing individual bytes to be passed into the method one at a time rather than as an array.
If a checksum needs to be performed on a segment of an array, rather than creating a copy of the array to perform the CRC on, you can pass in the entire buffer and specify the section of the array in which to perform the CRC calculation, saving time and memory:
// using text
var text = "I am string content";
// convert text to a byte array
var textBuffer = System.Text.Encoding.UTF8.GetBytes ( text );
// get the CRC for the text
var textCrc = NullFX.CRC.Crc32.ComputeChecksum ( textBuffer );
Console.WriteLine ( "Text CRC: {0:X8}", textCrc );
// use a large number
var aNumber = 0xDEADBEEF;
// convert that to a byte array
var numberBuffer = System.BitConverter.GetBytes ( aNumber );
// get the CRC for the number
var numberCrc = NullFX.CRC.Crc32.ComputeChecksum ( numberBuffer );
Console.WriteLine ( "Number CRC: {0:X8}", numberCrc );
// bytes as params
var randomCrc = NullFX.CRC.Crc32.ComputeChecksum ( 0x01, 0x02, 0x03, 0x04 );
Console.WriteLine ( "Random bytes CRC: {0:X8}", randomCrc );
/// checksum of a subset of an array. perform the CRC on bytes at indices
// 2, 3, 4 and 5
var bytes = new byte[] { 0xFE, 0x2C, 0xED, 0x4B, 0x88, 0x31, 0x07, 0xBE };
var segmentedBytesCrc = Crc32.ComputeChecksum ( bytes, 2, 4 );
Console.WriteLine ( "Segment of bytes CRC: {0:X8}", segmentedBytesCrc );
Output:
Text CRC: 3AD00FD2
Number CRC: 1A5A601F
Random bytes CRC: B63CFBCD
Segment of bytes CRC: DB1A36A1
API Information
Crc8
, and Crc32
's ComputeChecksum
have 2 different signatures
ComputeChecksum
(byte[]
bytes)
and
ComputeChecksum
(byte[]
bytes, int
start, int
length )
Crc16
has one additional initial parameter ( Crc16Algorithm
)
where Crc16Algorithm
is one of the following:
- Standard CRC 16
- CRC 16 CCITT with initial values of
0
,FFFF
and1D0F
- CRC 16 CCITT Kermit
- Modbus
ComputeChecksum
( Crc16Algorithm
algorithm, byte[] bytes )
and
ComputeChecksum
( Crc16Algorithm
algorithm, byte[] bytes, int
start, int
length )
Note: this repository is also mirrored on GitLab
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 | netcoreapp3.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 is compatible. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on NullFX.CRC:
Package | Downloads |
---|---|
TwitterStream
Stream twits without twitter api |
|
rct
Library to talk with rct power inverters |
|
Com.Ve.ServerDataReceiver
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on NullFX.CRC:
Repository | Stars |
---|---|
MeltyPlayer/FinModelUtility
Model viewer and command-line tools for extracting models from various GCN/3DS/PC games en-masse.
|