hbutils.encoding

Overview:

Encoding module, include some not so complex but useful functions. They will improve the quality of your coding experience when dealing with these data.

This module provides various encoding and decoding utilities including:

  • ANSI color and style encoding for terminal output

  • Base64 encoding and decoding operations

  • General decoding utilities for various data formats

  • Hash functions for data integrity and identification

  • Non-cryptographic integer hash functions for fast hashing

  • Hash function validation utilities

The module aggregates functionality from several submodules:

  • ansi: ANSI escape code handling for terminal formatting

  • base64: Base64 encoding/decoding utilities

  • decode: Automatic encoding detection and decoding

  • hash: Cryptographic hash function wrappers

  • int_hash: Non-cryptographic integer hash algorithms

  • int_hash_val: Hash function validation and testing utilities

Examples::
>>> from hbutils.encoding import md5, sha256
>>> md5(b'hello world')
'5eb63bbbe01eeed093cb22bb8f5acdc3'
>>> sha256(b'hello world')
'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
>>> from hbutils.encoding import int_hash
>>> int_hash("hello", method='FNV-1a-32')
1335831723