Repository navigation
OnixLabs.Core.Text.Base32FormatProvider
Represents a Base-32 format provider.
| Namespace | OnixLabs.Core.Text |
| Assembly | OnixLabs.Core.dll (NuGet) |
| Inheritance |
object → Enumeration<Base32FormatProvider> → Base32FormatProvider
|
| Implements |
IEquatable<Base32FormatProvider>, IComparable<Base32FormatProvider>, IComparable, IFormatProvider
|
public sealed class Base32FormatProvider : Enumeration<Base32FormatProvider>, IFormatProviderBase32FormatProvider is a smart enumeration that carries both the alphabet and the padding flag used by Base32Codec to encode and decode Base-32 values. It derives from Enumeration<Base32FormatProvider> and implements IFormatProvider.
Ten entries are declared, covering five widely-used alphabets in both an unpadded and a padded variant. When IsPadded is true, encoded output is padded with = characters to a multiple of eight characters, and decoding rejects input whose length is not a multiple of eight.
Because the type derives from Enumeration<T>, all entries are also available through the inherited static query methods such as GetAll, FromName, and FromValue.
Each alphabet is available in an unpadded and a padded variant. All fields are declared as public static readonly Base32FormatProvider.
| Field | Padded | Alphabet |
|---|---|---|
Rfc4648 |
No | ABCDEFGHIJKLMNOPQRSTUVWXYZ234567 |
ZBase32 |
No | ybndrfg8ejkmcpqxot1uwisza345h769 |
GeoHash |
No | 0123456789bcdefghjkmnpqrstuvwxyz |
Crockford |
No | 0123456789ABCDEFGHJKMNPQRSTVWXYZ |
Base32Hex |
No | 0123456789ABCDEFGHIJKLMNOPQRSTUV |
PaddedRfc4648 |
Yes | ABCDEFGHIJKLMNOPQRSTUVWXYZ234567 |
PaddedZBase32 |
Yes | ybndrfg8ejkmcpqxot1uwisza345h769 |
PaddedGeoHash |
Yes | 0123456789bcdefghjkmnpqrstuvwxyz |
PaddedCrockford |
Yes | 0123456789ABCDEFGHJKMNPQRSTVWXYZ |
PaddedBase32Hex |
Yes | 0123456789ABCDEFGHIJKLMNOPQRSTUV |
public static readonly Base32FormatProvider Rfc4648;The unpadded RFC 4648 Base-32 format provider. Alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ234567. This is the default provider used by Base32Codec.
public static readonly Base32FormatProvider ZBase32;The unpadded Z-Base-32 format provider. Alphabet ybndrfg8ejkmcpqxot1uwisza345h769. Z-Base-32 is a human-oriented encoding designed to be easier to read and type than RFC 4648.
public static readonly Base32FormatProvider GeoHash;The unpadded GeoHash Base-32 format provider. Alphabet 0123456789bcdefghjkmnpqrstuvwxyz. Used by the GeoHash geographic coordinate system.
public static readonly Base32FormatProvider Crockford;The unpadded Crockford Base-32 format provider. Alphabet 0123456789ABCDEFGHJKMNPQRSTVWXYZ. Douglas Crockford's Base-32 variant, designed for human readability by excluding ambiguous characters.
public static readonly Base32FormatProvider Base32Hex;The unpadded Base-32 Hex format provider. Alphabet 0123456789ABCDEFGHIJKLMNOPQRSTUV. Preserves the sort order of the underlying data when the encoded strings are compared lexicographically.
public static readonly Base32FormatProvider PaddedRfc4648;The padded RFC 4648 Base-32 format provider. Same alphabet as Rfc4648 but with = padding to a multiple of eight characters.
public static readonly Base32FormatProvider PaddedZBase32;The padded Z-Base-32 format provider. Same alphabet as ZBase32 but with = padding to a multiple of eight characters.
public static readonly Base32FormatProvider PaddedGeoHash;The padded GeoHash Base-32 format provider. Same alphabet as GeoHash but with = padding to a multiple of eight characters.
public static readonly Base32FormatProvider PaddedCrockford;The padded Crockford Base-32 format provider. Same alphabet as Crockford but with = padding to a multiple of eight characters.
public static readonly Base32FormatProvider PaddedBase32Hex;The padded Base-32 Hex format provider. Same alphabet as Base32Hex but with = padding to a multiple of eight characters.
| Property | Type | Description |
|---|---|---|
Alphabet |
string |
Gets the Base-32 alphabet associated with the current format provider. |
IsPadded |
bool |
Gets a value indicating whether the current format provider uses padding. |
public string Alphabet { get; }Gets the alphabet of the current Base32FormatProvider instance.
public bool IsPadded { get; }Gets a value indicating whether the current Base32FormatProvider instance uses padding. true if the current format provider uses padding; otherwise, false. When true, the associated Base32Codec pads encoded output to a multiple of eight characters with = and requires input lengths to be a multiple of eight during decoding.
| Method | Returns | Description |
|---|---|---|
GetFormat(Type?) |
object? |
Returns the current instance when formatType is typeof(Base32FormatProvider); otherwise, returns null. |
public object? GetFormat(Type? formatType)Returns the current instance when formatType is typeof(Base32FormatProvider); otherwise, returns null. This is the IFormatProvider contract method that allows the format provider to be passed to any API that accepts IFormatProvider.
| Parameter | Type | Description |
|---|---|---|
formatType |
Type? |
The type of format object to obtain. |
Returns — The current instance if formatType is typeof(Base32FormatProvider); otherwise, null.
ONIXLabs .NET Library · Repository · NuGet · License (Apache-2.0)
Copyright © ONIXLabs 2020. Licensed under the Apache License, Version 2.0.
- Enumeration<T>
- Optional<T>
- OptionalEqualityComparer<T>
- OptionalExtensions
- Result
- Result<T>
- ResultEqualityComparer<T>
- ResultExtensions
- Specification<T>
- Preconditions
- IValueEquatable<T>
- IValueComparable<T>
- IBinaryConvertible
- ISpanBinaryConvertible
- IMemoryBinaryConvertible
- ArrayExtensions
- ComparableExtensions
- DateTimeExtensions
- ISpanParsableExtensions
- ObjectExtensions
- RandomExtensions
- ReadOnlySequenceExtensions
- ReadOnlySpanExtensions
- StringExtensions
- Base16
- Base32
- Base58
- Base64
- IBaseCodec
- IBaseValue
- IBaseValue<T>
- Base16Codec
- Base32Codec
- Base58Codec
- Base64Codec
- Base16FormatProvider
- Base32FormatProvider
- Base58FormatProvider
- Base64FormatProvider
- EncodingExtensions
- ReadOnlySpanExtensions
- StringBuilderExtensions
- BigDecimal
- BigDecimalEqualityComparer
- BigDecimalOrdinalityComparer
- NumberInfo
- NumberInfoEqualityComparer
- NumberInfoOrdinalityComparer
- Int256
- Int512
- UInt256
- UInt512
- Float128
- Float256
- GenericMath
- NumericsExtensions
- ConversionMode
- ScaleMode
- Hash
- NamedHash
- Sha3
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- MerkleTree
- MerkleTree<T>
- PrivateKey
- PublicKey
- NamedPrivateKey
- NamedPublicKey
- EcdhPrivateKey
- EcdhPublicKey
- EcdsaPrivateKey
- EcdsaPublicKey
- EddsaPrivateKey
- EddsaPublicKey
- RsaPrivateKey
- RsaPublicKey
- DigitalSignature
- DigitalSignatureAndPublicKey
- Salt
- Secret
- ICryptoPrimitive<T>
- IHashable
- IEcdhPrivateKey
- IEcdsaPrivateKey
- IEddsaPrivateKey
- IRsaPrivateKey
- IPrivateKeyDerivable<T>
- IPrivateKeyExportable
- IPrivateKeyImportable<T>
- IPrivateKeyPemImportable<T>
- IPrivateKeyPkcs8Exportable
- IPrivateKeyPkcs8Importable<T>
- IPrivateKeyPkcs8PemExportable
- IPrivateKeyRawExportable
- IPrivateKeyRawImportable<T>
- IPrivateKeyRawPemExportable
- IEcdhPublicKey
- IEcdsaPublicKey
- IEddsaPublicKey
- IRsaPublicKey
- IPublicKeyExportable
- IPublicKeyImportable<T>
- IPublicKeyPemExportable
- IPublicKeyPemImportable<T>
- IPublicKeyRawExportable
- IPublicKeyRawImportable<T>
- HashAlgorithmExtensions
- ReadOnlySpanExtensions