Woohoo.Security.Cryptography 0.3.0

dotnet add package Woohoo.Security.Cryptography --version 0.3.0
                    
NuGet\Install-Package Woohoo.Security.Cryptography -Version 0.3.0
                    
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="Woohoo.Security.Cryptography" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Woohoo.Security.Cryptography" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Woohoo.Security.Cryptography" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Woohoo.Security.Cryptography --version 0.3.0
                    
#r "nuget: Woohoo.Security.Cryptography, 0.3.0"
                    
#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.
#:package Woohoo.Security.Cryptography@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Woohoo.Security.Cryptography&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Woohoo.Security.Cryptography&version=0.3.0
                    
Install as a Cake Tool

Woohoo.Security.Cryptography

GitHub Actions Workflow Status NuGet Version

Library of hash algorithms and utilities for .NET.

CRC32

To use the CRC32 hash algorithm, you can create an instance of the CRC32 class and call the ComputeHash method with your data.

using Woohoo.Security.Cryptography;

HashAlgorithm algorithm = CRC32.Create();

byte[] data = [1, 2, 3, 4, 5];
byte[] hash = algorithm.ComputeHash(data);

Hash Algorithm Factory

To create an instance of a hash algorithm by case-insensitive name, you can use the HashAlgorithmFactory class.

The following hash algorithms are supported: crc32, md5, sha1, sha256, sha384, sha512.

using Woohoo.Security.Cryptography;

HashAlgorithm crc32 = HashAlgorithmFactory.Create("crc32");
HashAlgorithm md5 = HashAlgorithmFactory.Create("md5");
HashAlgorithm sha1 = HashAlgorithmFactory.Create("sha1");

Hash Calculator

To compute multiple hash algorithms in one call, you can use the Calculate method on the HashCalculator class.

The hashes will be computed in parallel, and the results will be returned in a HashCalculatorResult object.

There are overloads to pass in either a stream or a file path.

using Woohoo.Security.Cryptography;

string path = "path/to/your/file.txt";

HashCalculatorResult result = new HashCalculator().Calculate(["CRC32", "MD5", "SHA1"], path);
byte[] crc32Hash = result.Checksums["CRC32"];
byte[] md5Hash = result.Checksums["MD5"];
byte[] sha1Hash = result.Checksums["SHA1"];

To be notified of progress, subscribe to the Progress event before calling Calculate.

using Woohoo.Security.Cryptography;

void ProgressHandler(object? sender, HashCalculatorProgressEventArgs ea)
{
    Console.WriteLine($"{ea.FilePath}: {ea.ProgressPercentage} percent done. {ea.ProgressBytes} of {ea.Length} bytes.");
}

string path = "path/to/your/file.txt";

HashCalculator calc = new HashCalculator();
calc.Progress += ProgressHandler;
calc.Calculate(["CRC32", "MD5", "SHA1"], path);

To abort a calculation, you can call the Cancel method on the HashCalculator instance.

To convert the byte array to a hexadecimal string, you can use the static HexToString method.

using Woohoo.Security.Cryptography;

string crc32Hex = HashCalculator.HexToString(crc32Hash);

XOR Transform

To encrypt/decrypt a byte array using a key, you can use the XorTransform class, which implements the System.Security.Cryptography.ICryptoTransform interface.

using Woohoo.Security.Cryptography;

byte[] key = [0x41, 0x76, 0x69, 0x73, 0x20, 0x44, 0x75, 0x72, 0x67, 0x61, 0x6e];
byte[] data = [0x00, 0x00, 0x05, 0x01, 0x02, 0x03, 0x01, 0x02, 0x03, 0x05, 0x00, 0x00];

using (var transform = new XorTransform(key))
{
    byte[] xor = transform.TransformFinalBlock(data, 0, data.Length);
}
Product 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 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  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 tizen40 was computed.  tizen60 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.
  • .NETFramework 4.7

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 210 7/14/2025
0.2.0 651 4/22/2025
0.1.0 229 4/22/2025