Skip to main content

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.

Project description

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.

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

binarychain-0.9.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

binarychain-0.9.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file binarychain-0.9.2.tar.gz.

File metadata

  • Download URL: binarychain-0.9.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for binarychain-0.9.2.tar.gz
Algorithm Hash digest
SHA256 baa753c208ed21d593b889d78bbc95ec430304ccb1b12ed2748ee6f483c4dca6
MD5 56ff70466030ec07471366797fc77aff
BLAKE2b-256 5862868efa0089318c37feac170045a46908aa9459f7020d700a62dc28dc1208

See more details on using hashes here.

File details

Details for the file binarychain-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: binarychain-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for binarychain-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 07010260e1858666f45bd5bdf86ab9ee7e2d16fc9ccab7c80852450575d14e6c
MD5 1fa87e1b7c602260f7c107e12e74aca9
BLAKE2b-256 6c2165171252555df40a72d38f9b0e2eb06a85078478e99f2c220f9484fd48e2

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