Skip to main content

Binary Chains

Binary Chains are a simple but flexible binary container format, primarily meant for sending blocks of binary data over streaming interfaces like sockets. Similar to NetStrings, but for binary data.

Binary Chain Format

A binary chain consists of a prefix, which is an ascii string (strictly bytes of value 0x00 to 0x7F) plus zero or more binary parts.

Each binary part starts with a SOP byte (0x80 to 0x88), the binary part length (big endian encoded), and then the actual data.

The number of bytes in the binary part length is indicated by the SOP byte.

  • 0x80 indicates 0 bytes - implying that the length of the binary part is 0. In this case there are no binary part length bytes, and the data for that part of the chain is of zero length.
  • 0x81 indicates a 1 byte part length - implying that the length of the binary part is between 1 and 255 bytes.
  • 0x82 indicates a 2 byte part length - implying that the length of the binary part is between 256 (0x0100) and 65535 (0xFFFF) bytes.
  • And so on...

The end of the chain is indicated by the EOC marker (0xFF).

So every part (prefix or binary part) is always terminated by a SOP byte or a EOC byte.

The prefix may be empty, and there may be no parts, in which case the serialisation is just the EOC (0xFF) byte.

Metadata

Release files for binarychain 0.9.2

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

Source distribution (sdist)

Source distribution for binarychain 0.9.2
File Size Uploaded Provenance
binarychain-0.9.2.tar.gz 6.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 11.7 kB

Release files / binarychain-0.9.2.tar.gz

Download URL binarychain-0.9.2.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
baa753c208ed21d593b889d78bbc95ec430304ccb1b12ed2748ee6f483c4dca6
BLAKE2b-256 checksum
How to use checksums
5862868efa0089318c37feac170045a46908aa9459f7020d700a62dc28dc1208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / binarychain-0.9.2-py3-none-any.whl

Download URL binarychain-0.9.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07010260e1858666f45bd5bdf86ab9ee7e2d16fc9ccab7c80852450575d14e6c
BLAKE2b-256 checksum
How to use checksums
6c2165171252555df40a72d38f9b0e2eb06a85078478e99f2c220f9484fd48e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for binarychain 0.9.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.2 This release

2 release files No provenance

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