documentation update
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user