#### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils 'index')
### [Abblix\.Utils](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils 'Abblix\.Utils')

## Base32 Class

Provides methods for encoding and decoding data using Base32 and Base32hex formats as defined in RFC 4648\.
Supports optional padding and ignores padding characters during decoding\.

```csharp
public static class Base32
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → Base32
### Methods

## Base32\.Decode\(ReadOnlySpan\<char\>\) Method {#Abblix.Utils.Base32.Decode(System.ReadOnlySpan_char_)}

Decodes a Base32\-encoded string into a byte array\.
Ignores any '=' padding characters at the end of the input\.

```csharp
public static byte[] Decode(System.ReadOnlySpan<char> input);
```
#### Parameters

###### `input` [System\.ReadOnlySpan&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1')[System\.Char](https://learn.microsoft.com/en-us/dotnet/api/system.char 'System\.Char')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1') {#Abblix.Utils.Base32.Decode(System.ReadOnlySpan_char_).input}

The Base32 string to decode \(may include padding '='\)\.

#### Returns
[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')  
A byte array containing the original binary data\.

#### Exceptions

[System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException')  
Thrown if the input contains invalid Base32 characters\.

## Base32\.DecodeHex\(ReadOnlySpan\<char\>\) Method {#Abblix.Utils.Base32.DecodeHex(System.ReadOnlySpan_char_)}

Decodes a Base32hex\-encoded string into a byte array\.
Ignores any '=' padding characters at the end of the input\.

```csharp
public static byte[] DecodeHex(System.ReadOnlySpan<char> input);
```
#### Parameters

###### `input` [System\.ReadOnlySpan&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1')[System\.Char](https://learn.microsoft.com/en-us/dotnet/api/system.char 'System\.Char')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1') {#Abblix.Utils.Base32.DecodeHex(System.ReadOnlySpan_char_).input}

The Base32hex string to decode \(may include padding '='\)\.

#### Returns
[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array 'System\.Array')  
A byte array containing the original binary data\.

#### Exceptions

[System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException')  
Thrown if the input contains invalid Base32hex characters\.

## Base32\.Encode\(ReadOnlySpan\<byte\>, bool\) Method {#Abblix.Utils.Base32.Encode(System.ReadOnlySpan_byte_,bool)}

Encodes the specified binary data into a Base32 string using the standard RFC 4648 alphabet \(A\-Z, 2\-7\)\.

```csharp
public static string Encode(System.ReadOnlySpan<byte> input, bool padding=true);
```
#### Parameters

###### `input` [System\.ReadOnlySpan&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1')[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1') {#Abblix.Utils.Base32.Encode(System.ReadOnlySpan_byte_,bool).input}

The binary data to encode\.

###### `padding` [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') {#Abblix.Utils.Base32.Encode(System.ReadOnlySpan_byte_,bool).padding}

`true` to include '=' characters to pad the output string to a multiple of 8 characters;
            `false` to omit padding\.

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')  
A Base32\-encoded string representation of the input data\. If [padding](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Base32#Abblix.Utils.Base32.Encode(System.ReadOnlySpan_byte_,bool).padding 'Abblix\.Utils\.Base32\.Encode\(System\.ReadOnlySpan\<byte\>, bool\)\.padding') is `true`,
the result length is always a multiple of 8 by adding '=' characters as needed\.

## Base32\.EncodeHex\(ReadOnlySpan\<byte\>, bool\) Method {#Abblix.Utils.Base32.EncodeHex(System.ReadOnlySpan_byte_,bool)}

Encodes the specified binary data into a Base32hex string using the extended hexadecimal alphabet \(0\-9, A\-V\)\.

```csharp
public static string EncodeHex(System.ReadOnlySpan<byte> input, bool padding=true);
```
#### Parameters

###### `input` [System\.ReadOnlySpan&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1')[System\.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte 'System\.Byte')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.readonlyspan-1 'System\.ReadOnlySpan\`1') {#Abblix.Utils.Base32.EncodeHex(System.ReadOnlySpan_byte_,bool).input}

The binary data to encode\.

###### `padding` [System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean') {#Abblix.Utils.Base32.EncodeHex(System.ReadOnlySpan_byte_,bool).padding}

`true` to include '=' characters to pad the output string to a multiple of 8 characters;
            `false` to omit padding\.

#### Returns
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')  
A Base32hex\-encoded string representation of the input data\. If [padding](https://www.abblix.com/en/docs/api/abblix-utils/Abblix.Utils.Base32#Abblix.Utils.Base32.EncodeHex(System.ReadOnlySpan_byte_,bool).padding 'Abblix\.Utils\.Base32\.EncodeHex\(System\.ReadOnlySpan\<byte\>, bool\)\.padding') is `true`,
the result length is always a multiple of 8 by adding '=' characters as needed\.
