nebulae.dotSHA3 0.1.2

dotnet add package nebulae.dotSHA3 --version 0.1.2
                    
NuGet\Install-Package nebulae.dotSHA3 -Version 0.1.2
                    
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="nebulae.dotSHA3" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nebulae.dotSHA3" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="nebulae.dotSHA3" />
                    
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 nebulae.dotSHA3 --version 0.1.2
                    
#r "nuget: nebulae.dotSHA3, 0.1.2"
                    
#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 nebulae.dotSHA3@0.1.2
                    
#: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=nebulae.dotSHA3&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=nebulae.dotSHA3&version=0.1.2
                    
Install as a Cake Tool

dotSHA3

dotSHA3 is a wrapper around Keccak's optimized SHA-3 C implementation as contained in libXKCP.

It provides both one-shot and incremental hashing (for streaming data).

Span-based, cross-platform, and verified against the NIST test vectors for each hash length (224/256/384/512) 100% (860/860) passing on all platforms.

In benchmarking, this library is exactly the same speed as Microsoft's System.Security.Cryptography SHA3 implementation, but supports stream hashing, which the built-in hasher does not.

Tests and benchmarks are included in the Gihub repository.

NuGet

Features

  • Cross-platform: Works on Windows, Linux, and macOS (x64 & Apple Silicon).
  • High performance: Optimized for speed, leveraging native SIMD-enabled code.
  • Easy to use: Simple API for generating keys and signing/verification.
  • Secure: Uses Keccak XKCP implementation, which is widely trusted in the industry.
  • Minimal dependencies: No external dependencies required (all are included), making it lightweight and easy to integrate.

Requirements

  • .NET 8.0 or later
  • Windows x64, Linux x64, or macOS (x64 & Apple Silicon)

Usage

Non-streaming (one-shot) hashing:


using System;
using System.Text;
using nebulae.dotSHA3;

class Program
{
    static void Main()
    {
        var input = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog");

        using var sha3 = new SHA3(SHA3Algorithm.Sha3_256);
        var hash = sha3.ComputeHash(input);

        Console.WriteLine("SHA3-256:");
        Console.WriteLine(Convert.ToHexString(hash));
    }
}

Stream hashing:


using System;
using System.Text;
using nebulae.dotSHA3;

class Program
{
    static void Main()
    {
        var chunk1 = Encoding.UTF8.GetBytes("The quick brown ");
        var chunk2 = Encoding.UTF8.GetBytes("fox jumps over ");
        var chunk3 = Encoding.UTF8.GetBytes("the lazy dog");

        using var sha3 = new SHA3(SHA3Algorithm.Sha3_256);
        sha3.Update(chunk1);
        sha3.Update(chunk2);
        sha3.Update(chunk3);
        var hash = sha3.FinalizeHash();

        Console.WriteLine("SHA3-256 (streamed):");
        Console.WriteLine(Convert.ToHexString(hash));
    }
}


using System;
using System.IO;
using nebulae.dotSHA3;

class Program
{
    static void Main(string[] args)
    {
        const string path = "largefile.bin";
        Span<byte> buffer = stackalloc byte[8192];

        using var sha3 = new SHA3(SHA3Algorithm.Sha3_512);
        using var fs = File.OpenRead(path);

        int bytesRead;
        while ((bytesRead = fs.Read(buffer)) > 0)
        {
            sha3.Update(buffer[..bytesRead]);
        }

        var hash = sha3.FinalizeHash();
        Console.WriteLine($"SHA3-512: {Convert.ToHexString(hash)}");
    }
}


Installation

You can install the package via NuGet:


$ dotnet add package nebulae.dotSHA3

Or via git:


$ git clone https://github.com/nebulaeonline/dotSHA3.git
$ cd dotSHA3
$ dotnet build


License

MIT

Roadmap

Unless there are vulnerabilities found, there are no plans to add any new features.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.1.2 241 8/6/2025
0.1.1 228 8/6/2025
0.1.0 219 8/5/2025