CryptoHives.Foundation.Threading.Analyzers 0.4.11-preview

This is a prerelease version of CryptoHives.Foundation.Threading.Analyzers.
dotnet add package CryptoHives.Foundation.Threading.Analyzers --version 0.4.11-preview
                    
NuGet\Install-Package CryptoHives.Foundation.Threading.Analyzers -Version 0.4.11-preview
                    
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="CryptoHives.Foundation.Threading.Analyzers" Version="0.4.11-preview">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CryptoHives.Foundation.Threading.Analyzers" Version="0.4.11-preview" />
                    
Directory.Packages.props
<PackageReference Include="CryptoHives.Foundation.Threading.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 CryptoHives.Foundation.Threading.Analyzers --version 0.4.11-preview
                    
#r "nuget: CryptoHives.Foundation.Threading.Analyzers, 0.4.11-preview"
                    
#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 CryptoHives.Foundation.Threading.Analyzers@0.4.11-preview
                    
#: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=CryptoHives.Foundation.Threading.Analyzers&version=0.4.11-preview&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CryptoHives.Foundation.Threading.Analyzers&version=0.4.11-preview&prerelease
                    
Install as a Cake Tool

๐Ÿ›ก๏ธ CryptoHives Open Source Initiative ๐Ÿ

An open, community-driven cryptography and performance library collection for the .NET ecosystem.


๐Ÿ CryptoHives .NET Foundation Packages

The CryptoHives Open Source Initiative is a collection of modern, high-assurance libraries for .NET, developed and maintained by The Keepers of the CryptoHives. Each package is designed for security, interoperability, and clarity โ€” making it easy to build secure systems for high performance transformation pipelines and for cryptography workloads without sacrificing developer experience.


๐Ÿ“š Documentation


๐Ÿ Available CryptoHives

Package Description NuGet Documentation
CryptoHives.Foundation.Memory Pooled buffers and streams NuGet Docs
CryptoHives.Foundation.Threading Pooled async synchronization NuGet Docs
CryptoHives.Foundation.Security.Cryptography Hash & MAC algorithms NuGet Docs

More packages will be published under the CryptoHives.* namespace โ€” see the Nuget CryptoHives for details.

๐Ÿฏ CryptoHives Health

Azure DevOps Tests codecov FOSSA Status


๐Ÿงฌ Features and Design Principles

๐Ÿงฑ Orthogonal Design

  • All development is done on free and open-source tools, e.g. .NET SDK, Visual Studio Community Edition, Visual Studio Code, GitHub, Azure DevOps, etc.
  • Each package is designed to be orthogonal and composable with other CryptoHives packages to avoid deep cross dependencies
  • Dependencies on other packages are kept to a minimum and shall only include widely adopted, well-maintained libraries, e.g. the Microsoft.Extensions
  • OS and hardware dependencies are avoided wherever possible to ensure deterministic behavior across all platforms and runtimes, specifically for security implementations
  • There is no intention to replace or shadow existing .NET class libraries; instead, CryptoHives packages are designed to complement and extend existing functionality

โšก High-Performance Primitives

  • CryptoHives provides a growing set of utilities designed to optimize high performance transformation pipelines and cryptography workloads.

๐Ÿ› ๏ธ Memory Efficiency

Pooled buffer management for transformation pipelines and high-frequency I/O:

  • ArrayPool-based allocators for common crypto and serialization scenarios
  • ArrayPoolMemoryStream โ€” drop-in MemoryStream replacement backed by ArrayPool<byte>
  • ReadOnlySequenceMemoryStream โ€” read from ReadOnlySequence<byte> without copying
  • ArrayPoolBufferWriter<T> โ€” IBufferWriter<T> over pooled arrays
  • Ownership primitives for zero-copy handoff of pooled buffers

๐Ÿš€ Concurrency Tools (Threading)

Async-compatible synchronization primitives built on ObjectPool and ValueTask<T>. Designed to eliminate Task / TaskCompletionSource<T> allocations on the hot path.

  • AsyncLock โ€” mutual exclusion
  • AsyncSemaphore โ€” counting semaphore
  • AsyncAutoResetEvent / AsyncManualResetEvent
  • AsyncReaderWriterLock
  • AsyncBarrier / AsyncCountdownEvent

All primitives support CancellationToken and ConfigureAwait(false) without the need for extra allocations. Nuget package contains a C# analyzer to avoid common ValueTask usage mistakes.

๐Ÿ” Managed Code Cryptography

Fully managed implementations of cryptographic hash algorithms and MACs, written from NIST/RFC/ISO specifications and verified against official test vectors. No OS crypto dependency โ€” deterministic results on every platform, in some cases even outperforming OS implementations.

Algorithms:

Family Algorithms
SHA-2 SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256
SHA-3 SHA3-224, SHA3-256, SHA3-384, SHA3-512
Keccak Keccak-256, Keccak-384, Keccak-512 (Ethereum compatible)
SHAKE / cSHAKE SHAKE128, SHAKE256, cSHAKE128, cSHAKE256
TurboSHAKE / KT TurboSHAKE128, TurboSHAKE256, KT128, KT256
BLAKE BLAKE2b, BLAKE2s (SIMD-accelerated), BLAKE3
Ascon Ascon-Hash256, Ascon-XOF128 (NIST lightweight)
MAC KMAC128, KMAC256, BLAKE2 keyed, BLAKE3 keyed
Regional SM3, Streebog, Kupyna, LSH, Whirlpool, RIPEMD-160
Legacy SHA-1, MD5 (backward compatibility only)

All XOF algorithms implement IExtendableOutput for streaming variable-length output via Absorb / Squeeze / Reset. BLAKE2b, BLAKE2s, and BLAKE3 use managed SIMD intrinsics (SSE2, SSSE3, AVX2) with scalar fallback.

๐Ÿงช Package Benchmarks

  • Async primitive benchmarks โ€” contested and uncontested scenarios, comparing pooled ValueTask vs. existing Task-based alternatives.
  • Hash algorithm benchmarks โ€” measured with BenchmarkDotNet across 128Bโ€“128KB payloads, comparing managed vs. BouncyCastle vs. OS implementations.

๐Ÿ”’ Fuzzed APIs (planned)

  • All libraries and public-facing APIs are planned to be fuzzed

๐Ÿงฉ Installation

Install via NuGet CLI:

dotnet add package CryptoHives.Foundation.Threading

Or using the Visual Studio Package Manager:

Install-Package CryptoHives.Foundation.Threading

๐Ÿง  Usage Examples


using CryptoHives.Foundation.Security.Cryptography.Hash;

// Allocation-free hash
using var blake3 = Blake3.Create();
Span<byte> hash = stackalloc byte[32];
blake3.TryComputeHash(data, hash, out _);

// XOF streaming (variable-length output)
using var shake = Shake256.Create(64);
shake.Absorb(data1);
shake.Absorb(data2);
Span<byte> output = stackalloc byte[128];
shake.Squeeze(output);

using CryptoHives.Foundation.Threading.Async.Pooled;

// Allocation-free async lock, even with cancellation token
private readonly AsyncLock _lock = new();

public async Task DoWorkAsync(CancellationToken ct)
{
    using await _lock.LockAsync(ct).ConfigureAwait(false);
    // critical section
}

๐Ÿงช Development Policy

All code within the CryptoHives .NET Foundation is developed with attention to correctness and security:

  • Implementations are written from official public specifications and standards (NIST, RFC, ISO)
  • All algorithms are verified against official test vectors from specification documents
  • Review process includes algorithm validation against reference implementations
  • Development may use AI-assisted tooling; no guarantee of clean-room provenance is claimed

๐Ÿ” Security Policy

Security is our top priority.

If you discover a vulnerability, please do not open a public issue.
Instead, please follow the guidelines on the CryptoHives Open Source Initiative Security Page.


๐Ÿ” Nuget Package Assembly Code Signing

Assemblies in our Nuget packages are currently not code signed. Once there is sufficient demand and funding available, the Keepers plan to implement code signing for all released packages.


๐Ÿ“ No-Nonsense Matters

This project is released under the MIT License because open collaboration matters.
However, the Keepers are well aware that MIT-licensed code often gets copied, repackaged, or commercialized without giving credit.

If you use this code, please do so responsibly:

  • Give visible credit to the CryptoHives Open Source Initiative or The Keepers of the CryptoHives and refer to the original source.
  • Contribute improvements back and report issues.

Open source thrives on respect, not just permissive licenses.


โš–๏ธ License

Each component of the CryptoHives Open Source Initiative is licensed under a SPDX-compatible MIT license.
By default, packages use the following license tags:

// SPDX-FileCopyrightText: <year> The Keepers of the CryptoHives
// SPDX-License-Identifier: MIT

Some inherited components may use alternative MIT license headers, according to their origin and specific requirements those headers are retained.


๐Ÿ About The Keepers of the CryptoHives

The CryptoHives Open Source Initiative project is maintained by The Keepers of the CryptoHives โ€”
a collective of developers dedicated to advancing open, verifiable, and high-performance cryptography in .NET.


๐Ÿงฉ Contributing

Contributions, issue reports, and pull requests are welcome!

Please see the Contributing Guide before submitting code.


ยฉ 2026 The Keepers of the CryptoHives

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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.4.11-preview 28 2/14/2026
0.3.19-preview 118 1/26/2026
0.2.43-preview 122 1/9/2026
0.2.33-preview 436 12/9/2025
0.2.30-preview 311 12/8/2025
0.2.28-preview 263 12/7/2025