hutool.core.util.base32_util

Base32 编解码工具类

Module Contents

Classes

Base32Util

Base32 编解码工具类。

Functions

_b32hex_encode

手动实现 Base32 Hex 编码。

_b32hex_decode

手动实现 Base32 Hex 解码。

Data

API

hutool.core.util.base32_util._HEX_ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUV'
hutool.core.util.base32_util._HEX_DECODE_MAP = None
hutool.core.util.base32_util._b32hex_encode(data: bytes) str

手动实现 Base32 Hex 编码。

hutool.core.util.base32_util._b32hex_decode(s: str) bytes

手动实现 Base32 Hex 解码。

class hutool.core.util.base32_util.Base32Util

Base32 编解码工具类。

static encode(data) str

Base32 编码。

参数:

data – 待编码的 bytes 或 str

返回:

Base32 编码字符串

static decode(base32_str: str) bytes

Base32 解码。

参数:

base32_str – Base32 编码字符串

返回:

解码后的 bytes

static encode_hex(data) str

Base32 Hex 编码(使用扩展十六进制字母表)。

参数:

data – 待编码的 bytes 或 str

返回:

Base32 Hex 编码字符串

static decode_hex(base32_hex_str: str) bytes

Base32 Hex 解码。

参数:

base32_hex_str – Base32 Hex 编码字符串

返回:

解码后的 bytes

static decode_str_hex(base32_hex_str: str, charset: str = 'utf-8') str

Base32 Hex 解码为字符串。

参数:
  • base32_hex_str – Base32 Hex 编码字符串

  • charset – 字符集,默认 "utf-8"

返回:

解码后的字符串