NCode.Buffers
5.1.1
Prefix Reserved
See the version list below for details.
dotnet add package NCode.Buffers --version 5.1.1
NuGet\Install-Package NCode.Buffers -Version 5.1.1
<PackageReference Include="NCode.Buffers" Version="5.1.1" />
<PackageVersion Include="NCode.Buffers" Version="5.1.1" />
<PackageReference Include="NCode.Buffers" />
paket add NCode.Buffers --version 5.1.1
#r "nuget: NCode.Buffers, 5.1.1"
#:package NCode.Buffers@5.1.1
#addin nuget:?package=NCode.Buffers&version=5.1.1
#tool nuget:?package=NCode.Buffers&version=5.1.1
NCode.Buffers
Pinned, pooled .NET buffers that zero themselves on dispose, for keys and other secrets, plus fixed-size buffer writers and string splitting without substring copies.
Installation
dotnet add package NCode.Buffers
The target frameworks are the ones the package's .csproj declares; they are listed on nuget.org's Frameworks tab and shown by the badge above. CHANGELOG.md records when a framework is added or dropped and which release line to stay on. The package depends on Nerdbank.Streams, whose Sequence<T> the pooled buffer writers return.
Example
This example derives a key from a password, verifies an HMAC-SHA256 signature with it, and zeroes the derived key and the expected MAC when the method returns.
using System.Security.Cryptography;
using NCode.Buffers;
public static class Signatures
{
public static bool VerifySignature(
ReadOnlySpan<byte> password,
ReadOnlySpan<byte> salt,
ReadOnlySpan<byte> payload,
ReadOnlySpan<byte> signature
)
{
// A pinned, pooled 32-byte key, zeroed when keyOwner is disposed.
using var keyOwner = BufferFactory.Rent(32, isSensitive: true, out Span<byte> key);
Rfc2898DeriveBytes.Pbkdf2(
password,
salt,
key,
iterations: 600_000,
HashAlgorithmName.SHA256
);
// The expected MAC lives on the stack and is zeroed when expectedLifetime is disposed.
Span<byte> expected = stackalloc byte[HMACSHA256.HashSizeInBytes];
using var expectedLifetime = expected.GetSecureLifetime();
HMACSHA256.HashData(key, payload, expected);
// Constant time, so the comparison doesn't reveal where the MACs differ.
return CryptographicOperations.FixedTimeEquals(expected, signature);
}
}
Learn more
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- JetBrains.Annotations (>= 2026.2.0)
- Nerdbank.Streams (>= 2.14.411)
NuGet packages (57)
Showing the top 5 NuGet packages that depend on NCode.Buffers:
| Package | Downloads |
|---|---|
|
NCode.Extensions.DataProtection
Extensions and utilities for ASP.NET Core Data Protection, including a type-safe factory pattern for creating IDataProtector instances with automatic purpose string derivation, and high-performance span-based protection operations using IBufferWriter. |
|
|
NCode.Identity.Json
The JSON value model of JOSE, OAuth and OpenID Connect for NCode.Identity: NumericDate coercion, claim sets as object graphs, strict claim reads on JsonElement and the family's JSON converters. |
|
|
NCode.Identity.Jwk
First-class JSON Web Key (JWK) and JSON Web Key Set (JWKS) types for NCode.Identity, with JWK Thumbprint (RFC 7517 / 7638 / 9278) — a rich, serializable key model shared by the JOSE and Secrets libraries. |
|
|
NCode.Identity.Secrets.Abstractions
Package Description |
|
|
NCode.Identity.Events.Abstractions
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.2.5 | 0 | 11/19/2026 |
| 5.2.4 | 0 | 11/19/2026 |
| 5.2.3 | 0 | 11/18/2026 |
| 5.2.2 | 0 | 11/18/2026 |
| 5.2.1 | 0 | 11/18/2026 |
| 5.2.0 | 0 | 11/18/2026 |
| 5.1.3 | 58 | 11/18/2026 |
| 5.1.2 | 61 | 11/17/2026 |
| 5.1.1 | 58 | 11/17/2026 |
| 5.1.0 | 62 | 11/17/2026 |
| 5.0.3 | 105 | 11/15/2026 |
| 5.0.2 | 100 | 11/15/2026 |
| 5.0.1 | 86 | 11/15/2026 |
| 5.0.0 | 106 | 11/15/2026 |
| 4.1.0 | 3,517 | 1/21/2026 |
| 4.0.0 | 170 | 1/17/2026 |
See the changelog: https://github.com/NCodeGroup/Buffers/blob/HEAD/CHANGELOG.md