-
Notifications
You must be signed in to change notification settings - Fork 0
simpleotp.encoding.base32encoder
Namespace: SimpleOTP.Encoding
Provides methods for encoding and decoding data using the RFC 4648 Base32 standard alphabet.
public class Base32Encoder : IEncoderInheritance Object → Base32Encoder
Implements IEncoder
Attributes NullableContextAttribute, NullableAttribute
Gets the singleton instance of the Base32Encoder class.
public static Base32Encoder Instance { get; }public string Scheme { get; }public Base32Encoder()Converts a byte array to a Base32 string representation.
public string EncodeBytes(Byte[] bytes)bytes Byte[]
The byte array to convert.
String
The Base32 string representation of the byte array.
ArgumentNullException
Thrown when parameter is null.
Converts a Base32 encoded string to a byte array.
public Byte[] GetBytes(string inArray)inArray String
The Base32 encoded string to convert.
Byte[]
The byte array representation of the Base32 encoded string.
ArgumentNullException
Thrown when parameter is null.
ArgumentException
Thrown when inArray is empty, whitespace, or contains invalid characters.
Remarks:
Trailing bits are ignored (e.g. AAAR will be treated as AAAQ - 0x00 0x01).
Converts a Base32 character to its numeric value.
protected int CharToValue(char c)c Char
The Base32 character to convert.
Int32
The numeric value of the Base32 character.
ArgumentException
Thrown when c is not a valid Base32 character.
Converts a numeric value to its Base32 character.
protected char ValueToChar(int value)value Int32
The numeric value to convert.
Char
The Base32 character corresponding to the numeric value.
ArgumentException
Thrown when value is not a valid Base32 value.
©2025 Eugene Fox. Licensed under MIT license