NCode.Base64Url 2.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package NCode.Base64Url --version 2.0.0
                    
NuGet\Install-Package NCode.Base64Url -Version 2.0.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="NCode.Base64Url" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NCode.Base64Url" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NCode.Base64Url" />
                    
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 NCode.Base64Url --version 2.0.0
                    
#r "nuget: NCode.Base64Url, 2.0.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 NCode.Base64Url@2.0.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=NCode.Base64Url&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NCode.Base64Url&version=2.0.0
                    
Install as a Cake Tool

ci

Overview

This library provides methods for encoding and decoding base64url (RFC 4648) data using the new memory efficient Span and Buffer APIs.

namespace NCode.Encoders;

public static class Base64Url
{
    // Encode...

    public static int GetCharCountForEncode(
        int byteCount
    );

    public static string Encode(
        ReadOnlySpan<byte> bytes
    );

    public static int Encode(
        ReadOnlySpan<byte> bytes,
        IBufferWriter<char> writer
    );

    public static int Encode(
        ReadOnlySequence<byte> sequence,
        IBufferWriter<char> writer
    );

    public static bool TryEncode(
        ReadOnlySequence<byte> sequence,
        Span<char> chars,
        out int charsWritten
    );

    public static bool TryEncode(
        ReadOnlySpan<byte> bytes,
        Span<char> chars,
        out int charsWritten
    );

    // Decode...

    public static int GetByteCountForDecode(
        int charCount
    );

    public static byte[] Decode(
        ReadOnlySpan<char> chars
    );

    public static int Decode(
        ReadOnlySpan<char> chars,
        IBufferWriter<byte> writer
    );

    public static int Decode(
        ReadOnlySequence<char> sequence,
        IBufferWriter<byte> writer
    );

    public static bool TryDecode(
        ReadOnlySequence<char> sequence,
        Span<byte> bytes,
        out int bytesWritten
    );

    public static bool TryDecode(
        ReadOnlySpan<char> chars,
        Span<byte> bytes,
        out int bytesWritten
    );
}

Release Notes

  • v1.0.0 - Initial release
  • v1.1.0 - Added support for sequences
  • v1.1.1 - Added support for sequences without buffer writer
  • v1.1.2 - Added optimization for single segment sequences
  • v2.0.0 - Targeting .NET 8.0 and above only
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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • 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
2.0.1 90 1/17/2026
2.0.0 94 1/11/2026
1.1.2 449 7/30/2023
1.1.1 259 7/28/2023
1.1.0 251 7/28/2023
1.0.0 269 7/16/2023
0.0.4 288 7/16/2023
0.0.3 260 7/16/2023
0.0.2 268 7/15/2023

Built on 2026-01-11 21:56:23Z