nebulae.dotSipHash 0.1.0

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

dotSiphash

A minimal, fast, cross-platform SipHash for .NET applications.

This library provides access to the SipHash hashing algorithm, which is a fast and secure hash function designed for short inputs. It is particularly useful for hash tables and other applications where performance and security are critical.

Tests are included and available in the Github repo.

NuGet


Features

  • Easy to use: Simple API for hashing
  • Minimal dependencies: No external dependencies required, making it lightweight and easy to integrate.

Requirements

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

Usage

dotSipHash is a wrapper around the reference implementation of SipHash. It provides a simple API for hashing data using the SipHash algorithm, which is a fast and secure hash function designed for short inputs.


using nebulae.dotSipHash;

// 16-byte SipHash key (must be exactly 16 bytes)
byte[] key = new byte[16] {
    0x00, 0x01, 0x02, 0x03,
    0x04, 0x05, 0x06, 0x07,
    0x08, 0x09, 0x0A, 0x0B,
    0x0C, 0x0D, 0x0E, 0x0F
};

// Data to hash
byte[] message = System.Text.Encoding.UTF8.GetBytes("Hello, SipHash!");

// --- 64-bit hash using byte[] ---
ulong hash64 = SipHash.Compute64(message, key);

// --- 64-bit hash using Span<T> ---
Span<byte> keySpan = key;
Span<byte> dataSpan = message;
ulong hash64Span = SipHash.Compute64(dataSpan, keySpan);

// --- 128-bit hash using byte[] ---
byte[] hash128 = SipHash.Compute128(message, key);

// --- 128-bit hash using Span<T> ---
Span<byte> output = stackalloc byte[16];
bool success = SipHash.TryCompute128(dataSpan, keySpan, output);


Installation

You can install the package via NuGet:


$ dotnet add package nebulae.dotSipHash

Or via git:


$ git clone https://github.com/nebulaeonline/dotSipHash.git
$ cd dotSipHash
$ 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.0 163 9/20/2025