documentation update
.NET Test / .NET tests (push) Successful in 1m58s
.NET Publish / publish (push) Successful in 58s

This commit is contained in:
2026-07-10 22:16:20 +04:00
parent 8e961352d2
commit e37e9b65c3
9 changed files with 137 additions and 11 deletions
+22
View File
@@ -1,20 +1,42 @@
namespace Just.Core;
/// <summary>
/// Encoding options for <see cref="Base32.Encode(ReadOnlySpan{byte}, Base32EncodeOptions)"/>.
/// </summary>
[Flags]
public enum Base32EncodeOptions
{
/// <summary>Standard RFC 4648 encoding (uppercase with padding).</summary>
None = 0x00,
/// <summary>Use lowercase alphabet.</summary>
LowerCase = 0x01,
/// <summary>Omit padding characters.</summary>
NoPadding = 0x02,
/// <summary>Lowercase alphabet without padding (combines <see cref="LowerCase"/> | <see cref="NoPadding"/>).</summary>
LowerCaseNoPadding = 0x03,
}
/// <summary>
/// RFC 4648 Base32 encoder/decoder with span-based APIs.
/// Uses stack allocation for inputs up to <see cref="MaxBytesStack"/> bytes; heap allocation otherwise.
/// </summary>
public static class Base32
{
/// <summary>RFC 4648 Base32 alphabet (uppercase A-Z, 2-7).</summary>
public const string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
/// <summary>Lowercase variant of the RFC 4648 alphabet.</summary>
public const string AlphabetLower = "abcdefghijklmnopqrstuvwxyz234567";
/// <summary>Padding character (=).</summary>
public const char Padding = '=';
/// <summary>Maximum input byte count that uses stack allocation instead of heap.</summary>
public const int MaxBytesStack = 250;
/// <summary>
/// Encodes a byte span into a Base32 string.
/// </summary>
/// <param name="input">The bytes to encode.</param>
/// <param name="options">Encoding options (casing, padding). Defaults to standard RFC 4648.</param>
/// <returns>The Base32-encoded string.</returns>
[Pure]
public static string Encode(ReadOnlySpan<byte> input, Base32EncodeOptions options = Base32EncodeOptions.None)
{