Skip to main content

HexBytes

Join the conversation on Discord Build Status PyPI version Python versions Docs build

Python bytes subclass that decodes hex, with a readable console output

Read the documentation.

View the change log.

Quickstart

python -m pip install hexbytes
# convert from bytes to a prettier representation at the console
>>> HexBytes(b"\x03\x08wf\xbfh\xe7\x86q\xd1\xeaCj\xe0\x87\xdat\xa1'a\xda\xc0 \x01\x1a\x9e\xdd\xc4\x90\x0b\xf1;")
HexBytes('0x03087766bf68e78671d1ea436ae087da74a12761dac020011a9eddc4900bf13b')

# HexBytes accepts the hex string representation as well, ignoring case and 0x prefixes
>>> hb = HexBytes('03087766BF68E78671D1EA436AE087DA74A12761DAC020011A9EDDC4900BF13B')
HexBytes('0x03087766bf68e78671d1ea436ae087da74a12761dac020011a9eddc4900bf13b')

# get the first byte:
>>> hb[0]
3

# show how many bytes are in the value
>>> len(hb)
32

# cast back to the basic `bytes` type
>>> bytes(hb)
b"\x03\x08wf\xbfh\xe7\x86q\xd1\xeaCj\xe0\x87\xdat\xa1'a\xda\xc0 \x01\x1a\x9e\xdd\xc4\x90\x0b\xf1;"

Metadata

Release files for hexbytes 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hexbytes 1.2.1
File Size Uploaded
hexbytes-1.2.1.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hexbytes 1.2.1
File Interpreter ABI Platform
hexbytes-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / hexbytes-1.2.1.tar.gz

Download URL hexbytes-1.2.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
515f00dddf31053db4d0d7636dd16061c1d896c3109b8e751005db4ca46bcca7
BLAKE2b-256 checksum
How to use checksums
4e5106836a542b773bfc60ab871fa08d4a7963e7df6754ca57169e2654287cc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / hexbytes-1.2.1-py3-none-any.whl

Download URL hexbytes-1.2.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e64890b203a31f4a23ef11470ecfcca565beaee9198df623047df322b757471a
BLAKE2b-256 checksum
How to use checksums
39c620f25ea73e4ceffb3eb4e38347f2992cb25e5ff6eb644d52e753a7a72f57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page