yabase/core/encoding

Types

Core encoding types for yabase. Variants for Base32 encoding.

pub type Base32Variant {
  RFC4648
  Hex
  Crockford
  CrockfordCheck
  Clockwork
  ZBase32
}

Constructors

  • RFC4648

    RFC 4648 standard Base32

  • Hex

    RFC 4648 Base32 with extended hex alphabet

  • Crockford

    Crockford’s Base32

  • CrockfordCheck

    Crockford’s Base32 with mod-37 check symbol

  • Clockwork

    Clockwork Base32 (human-friendly, no padding)

  • ZBase32

    z-base-32 (human-oriented, no padding)

Result of decoding a Base58Check string.

pub type Base58CheckDecoded {
  Base58CheckDecoded(version: Int, payload: BitArray)
}

Constructors

  • Base58CheckDecoded(version: Int, payload: BitArray)

Variants for Base58 encoding.

pub type Base58Variant {
  Bitcoin
  Flickr
}

Constructors

  • Bitcoin

    Bitcoin alphabet (uppercase before lowercase)

  • Flickr

    Flickr alphabet (lowercase before uppercase)

Variants for Base64 encoding.

pub type Base64Variant {
  Standard
  UrlSafe
  NoPadding
  UrlSafeNoPadding
  DQ
}

Constructors

  • Standard

    RFC 4648 standard Base64 (with padding)

  • UrlSafe

    URL-safe Base64 with padding (RFC 4648 section 5)

  • NoPadding

    Standard Base64 without padding

  • UrlSafeNoPadding

    URL-safe Base64 without padding

  • DQ

    Dragon Quest revival password style Base64 (hiragana)

Variants for Base85 encoding.

pub type Base85Variant {
  Btoa
  Adobe
  Rfc1924
  Z85
}

Constructors

  • Btoa

    btoa-style Ascii85 (z for all-zero, y for all-space)

  • Adobe

    Adobe Ascii85 with <~ ~> delimiters

  • Rfc1924

    RFC 1924 alphabet (input must be 4-byte aligned)

  • Z85

    ZeroMQ Z85 (input must be 4-byte aligned)

Result of decoding a Bech32/Bech32m string.

pub type Bech32Decoded {
  Bech32Decoded(
    hrp: String,
    data: BitArray,
    variant: Bech32Variant,
  )
}

Constructors

  • Bech32Decoded(
      hrp: String,
      data: BitArray,
      variant: Bech32Variant,
    )

Bech32 encoding variant.

pub type Bech32Variant {
  Bech32
  Bech32m
}

Constructors

  • Bech32

    BIP 173 original Bech32

  • Bech32m

    BIP 350 improved Bech32m

Errors that can occur during encoding or decoding.

pub type CodecError {
  InvalidCharacter(character: String, position: Int)
  InvalidLength(length: Int)
  Overflow
  UnsupportedPrefix(prefix: String)
  UnsupportedMultibaseEncoding(encoding_name: String)
  InvalidChecksum
  InvalidHrp(reason: String)
}

Constructors

  • InvalidCharacter(character: String, position: Int)

    Input contains a character not in the encoding’s alphabet.

  • InvalidLength(length: Int)

    Input length is not valid for the encoding.

  • Overflow

    Decoded value overflows the expected range.

  • UnsupportedPrefix(prefix: String)

    An unknown multibase prefix was encountered during decode.

  • UnsupportedMultibaseEncoding(encoding_name: String)

    An encoding has no assigned multibase prefix (e.g. Base64 DQ).

  • InvalidChecksum

    Checksum verification failed (Base58Check, Bech32).

  • InvalidHrp(reason: String)

    Invalid human-readable part in Bech32/Bech32m.

A decoded value tagged with its detected encoding.

pub type Decoded {
  Decoded(encoding: Encoding, data: BitArray)
}

Constructors

  • Decoded(encoding: Encoding, data: BitArray)

Represents a supported encoding scheme.

pub type Encoding {
  Base2
  Base8
  Base10
  Base16
  Base32(Base32Variant)
  Base36
  Base45
  Base58(Base58Variant)
  Base62
  Base64(Base64Variant)
  Base85(Base85Variant)
  Base91
}

Constructors

Values

pub fn base10() -> Encoding

Decimal (base-10) encoding.

pub fn base16() -> Encoding

Hexadecimal (base-16) encoding.

pub fn base2() -> Encoding

Binary (base-2) encoding.

pub fn base32_clockwork() -> Encoding

Clockwork Base32 (human-friendly, no padding).

pub fn base32_crockford() -> Encoding

Crockford’s Base32.

pub fn base32_crockford_check() -> Encoding

Crockford’s Base32 with mod-37 check symbol.

pub fn base32_hex() -> Encoding

RFC 4648 Base32 with extended hex alphabet.

pub fn base32_rfc4648() -> Encoding

RFC 4648 standard Base32.

pub fn base32_z_base32() -> Encoding

z-base-32 (human-oriented, no padding).

pub fn base36() -> Encoding

Base36 encoding.

pub fn base45() -> Encoding

Base45 encoding (RFC 9285).

pub fn base58_bitcoin() -> Encoding

Base58 with the Bitcoin alphabet.

pub fn base58_flickr() -> Encoding

Base58 with the Flickr alphabet.

pub fn base62() -> Encoding

Base62 encoding.

pub fn base64_dq() -> Encoding

Dragon Quest revival password style Base64 (hiragana).

pub fn base64_no_padding() -> Encoding

Standard Base64 without padding.

pub fn base64_standard() -> Encoding

RFC 4648 standard Base64 (with padding).

pub fn base64_url_safe() -> Encoding

URL-safe Base64 with padding (RFC 4648 section 5).

pub fn base64_url_safe_no_padding() -> Encoding

URL-safe Base64 without padding.

pub fn base8() -> Encoding

Octal (base-8) encoding.

pub fn base85_adobe() -> Encoding

Adobe Ascii85 with <~ ~> delimiters.

pub fn base85_btoa() -> Encoding

btoa-style Ascii85.

pub fn base85_rfc1924() -> Encoding

RFC 1924 Base85.

pub fn base85_z85() -> Encoding

ZeroMQ Z85 Base85.

pub fn base91() -> Encoding

Base91 encoding.

Search Document