force-net / Crc32.NET

Fast version of Crc32 algorithm for .NET
MIT License
199 stars 52 forks source link

support chaining style code #20

Open Newp opened 4 years ago

Newp commented 4 years ago

as-is

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
Console.WriteLine(crc.ToHexString());

to-be

var crc = CrcAlgorithm
.CreateCrc16CcittFalse()
.Append(Encoding.ASCII.GetBytes("Hurray for cake!"));

Console.WriteLine(crc.ToHexString());