Skip to main content

Mutable LSB-first bit buffer utilities.

Project description

bitbuf

A small mutable, LSB-first bit buffer for Python.

from bitbuf import bitbuf

buf = bitbuf.from_bytes(b"\x34\x12")

buf[4:12] = 0xAB
buf <<= 3
buf.append_msb(4, 0b1010)

value = int(buf)
payload = bytes(buf)

Bit position 0 is the least significant bit. Byte conversion uses little-endian order.

Development

python -m pip install -e ".[test]"
python -m pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitbuf-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bitbuf-0.1.0-py3-none-any.whl (1.2 kB view details)

Uploaded Python 3

File details

Details for the file bitbuf-0.1.0.tar.gz.

File metadata

  • Download URL: bitbuf-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for bitbuf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd0192a9b2ab65ac0143c589b76fd57b6abc32474f595ee0550c8db7ded5398f
MD5 66bcbaa4fe0f8148153ea7966fc02b6b
BLAKE2b-256 4d95b7d6e8f04c03473d5741beafcd033170bad295e570cdf24f8c9fb7f305b0

See more details on using hashes here.

File details

Details for the file bitbuf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bitbuf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for bitbuf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fedb710d871df8128298c306ade7106062ba0e004e962aaa6da28524d3af1164
MD5 17d624194079705895e7b0dbaff8f7e8
BLAKE2b-256 ec4106ccd07ba7de2018ec22335e9f5772d228c4cf7cd68539c0a56ef7435c6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page