{"id":16592447,"url":"https://github.com/hauleth/ernie","last_synced_at":"2025-03-21T13:31:32.094Z","repository":{"id":140294894,"uuid":"171370314","full_name":"hauleth/ernie","owner":"hauleth","description":"Efficient binary encoding for your data (based on Erlang's External Terms Format)","archived":false,"fork":false,"pushed_at":"2020-02-01T16:30:11.000Z","size":21,"stargazers_count":36,"open_issues_count":6,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-01T06:42:12.162Z","etag":null,"topics":["binary-format","elixir","erlang","ernie","etf","rust","specification"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hauleth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["hauleth"]}},"created_at":"2019-02-18T23:17:02.000Z","updated_at":"2024-06-25T11:07:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"827c57c6-fa54-4e65-8d81-36ef065163dc","html_url":"https://github.com/hauleth/ernie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fernie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fernie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fernie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fernie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hauleth","download_url":"https://codeload.github.com/hauleth/ernie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244141580,"owners_count":20404835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-format","elixir","erlang","ernie","etf","rust","specification"],"created_at":"2024-10-11T23:20:56.808Z","updated_at":"2025-03-21T13:31:32.085Z","avatar_url":"https://github.com/hauleth.png","language":"Rust","funding_links":["https://github.com/sponsors/hauleth"],"categories":[],"sub_categories":[],"readme":"Ernie\n======================\n\nSimple binary data exchange format that is based on [External Term Format][ETF]\nin Erlang. This is update on [BERT][] which is a little bit outdated right now.\n\n### Name\n\nErnie is fun over the original BERT name, from the Sesame Street Bert \u0026 Ernie\ncouple.\n\n### RPC\n\nNo, this document will not define RPC syntax because of 2 reasons:\n\n1. This is out of scope of this document. It is meant to define only data\n   encoding format, not services one will use it for.\n2. Authors of this document believes that RPC are bad, and you should not use\n   them. Instead use message passing between your services.\n\n### Schema/structured data\n\nThis is meant to encode free-form data, if you want to encode structured data\nwith schema then we highly suggest you to take look into other formats like:\n\n- ASN.1 and any of it's encodings\n- ProtoBuffers\n- Apache Thrift\n- FlatBuffers\n- Cap'n'Proto\n\nSpecification\n-------------\n\n### Introduction\n\n1. The key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\",\n   \"SHOULD\", \"SHOULD NOT\", \"RECOMMENDED\", \"MAY\", and \"OPTIONAL\" in this\n   document are to be interpreted as described in [BCP 14][bcp14].\n\n### Types\n\n1. Integer\n\n    Binary representation of integers.\n\n    Implementation MUST support at least 8-bit unsigned and 32-bit signed\n    integers with full precision.\n\n2. 64-bit Float\n\n    IEEE 754 double precision floats.\n\n    Implementation MUST support all non-NaN, non-infinite, non-subnormal values\n    described in IEEE 754 binary64 spec. Implementations SHOULD NOT encode these\n    values.\n\n3. Tuple\n\n    Fixed length sequence of values.\n\n4. List\n\n    Dynamic length sequence of values.\n\n5. Binary\n\n    Representation of bytes with arbitrary length. If used to store\n    human-readable strings it MUST be encoded as correct UTF-8 string.\n\n6. Map\n\n    List of key-value pairs in arbitrary order. Keys MUST NOT appear twice in\n    the same map.\n\n### Encoding\n\n1. Top level\n\n    Binary encoded data MUST start with magic byte of decimal value of `131`\n    followed by single byte `Tag` value followed by arbitrary length data:\n\n        0        1       2\n        +--------+-------+-------+-------\n        | 131    | Tag   | Data ...\n        +--------+-------+-------+-------\n\n2. Integer\n\n    Integer can be encoded in 3 different forms:\n\n    - Values in range 0..255 (aka byte)\n\n            0       1        2\n            +-------+--------+\n            | 97    | Data   |\n            +-------+--------+\n\n        Where `Data` is unsigned byte representation of value.\n\n    - Values in range -4 294 967 295..4 294 967 294 (signed 32-bit value)\n\n            0       1       2      3      4      5\n            +-------+-------+------+------+------+\n            | 98    | Data                       |\n            +-------+-------+------+------+------+\n\n        Where `Data` is signed 32-bit representation of integer in U2 big-endian\n        encoding.\n\n    - \"Short\" arbitrary long signed integers (up to 2040-bit)\n\n            0       1       2       3     ...     N+3\n            +-------+-------+-------+------+------+\n            | 110   | N     | Sign  | Data        |\n            +-------+-------+-------+------+------+\n\n        `N` is big-endian 16-bit unsigned integer. `Data` represents little-endian\n        encoded `N` byte long integer. `Sign` is `0` for positive integer\n        and `1` for negative one.\n\n    - \"Long\" arbitrary long signed integers (from 2041 to 524 288-bit long)\n\n            0       1       2       3       4     ...     N+4\n            +-------+-------+-------+-------+------+------+\n            | 111   | N             | Sign  | Data        |\n            +-------+-------+-------+-------+------+------+\n\n        `N` is big-endian 16-bit unsigned integer. `Data` represents little-endian\n        encoded `N` byte long integer. `Sign` is `0` for positive integer\n        and `1` for negative one.\n\n3. Float\n\n        0       1       2        3       4       5       6       7       8       9\n        +-------+-------+--------+-------+-------+-------+-------+-------+-------+\n        | 70    | Data                                                           |\n        +-------+-------+--------+-------+-------+-------+-------+-------+-------+\n\n    Where `Data` is IEEE 754 double precision floating-point number encoded as\n    big-endian.\n\n4. Tuple\n\n    - Tuples up to 255 elements\n\n            0       1       2       ...       N+2\n            +-------+-------+--------+--------+\n            | 104   | Arity | Data ...        |\n            +-------+-------+--------+--------+\n\n    - Tuples up to 4 294 967 295 elements\n\n            0       1       2        3        4        5       ...       N+5\n            +-------+-------+--------+--------+--------+--------+--------+\n            | 105   | Arity                            | Data ...        |\n            +-------+-------+--------+--------+--------+--------+--------+\n\n    Where `Arity` is big-endian unsigned integer declaring amount of elements in\n    `Data`.\n\n5. List\n\n    - Byte list\n\n            0       1       2       3      ...      N+3\n            +-------+-------+-------+-------+-------+\n            | 107   | N             | Data ...      |\n            +-------+-------+-------+-------+-------+\n\n        This is optimisation for lists that contains only values in range\n        0..255, inclusive.\n\n    - General list\n\n            0       1       2       3       4       5      ...      N+5     N+6\n            +-------+-------+-------+-------+-------+-------+-------+-------+\n            | 108   | Arity                         | Data ...      | 106   |\n            +-------+-------+-------+-------+-------+-------+-------+-------+\n\n        Where `Arity` is big-endian unsigned 32-bit integer declaring amount\n        of elements in `Data`.\n\n    - Empty list\n\n            0       1\n            +-------+\n            | 106   |\n            +-------+\n\n6. Binary\n\n        0       1       2       3       4       5      ...      N+5\n        +-------+-------+-------+-------+-------+-------+-------+\n        | 109   | N                             | Data ...      |\n        +-------+-------+-------+-------+-------+-------+-------+\n\n7. Map\n\n        0       1       2       3       4       5      ...      N+5\n        +-------+-------+-------+-------+-------+-------+-------+\n        | 116   | Arity                         | Data ...      |\n        +-------+-------+-------+-------+-------+-------+-------+\n\n    The `Arity` field is an unsigned 32-bit integer in big-endian format that\n    determines the number of key-value pairs in the map. Key and value pairs\n    (`Ki =\u003e Vi`) are encoded in section `Data` in the following order:\n    `K1, V1, K2, V2,..., Kn, Vn`.\n\nOpen questions\n--------------\n\n1. Should we support atoms?\n2. Should we allow defining improper lists?\n\nLicense\n-------\n\nThis document is released on [Creative Commons Attribution-ShareAlike 4.0\nInternational License](http://creativecommons.org/licenses/by-sa/4.0/).\n\n[BERT]: http://bert-rpc.org\n[ETF]: http://erlang.org/doc/apps/erts/erl_ext_dist.html\n[bcp14]: https://tools.ietf.org/html/bcp14\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauleth%2Fernie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhauleth%2Fernie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauleth%2Fernie/lists"}