{"id":16287617,"url":"https://github.com/ionite34/base2048","last_synced_at":"2025-03-16T13:31:28.915Z","repository":{"id":60222087,"uuid":"537878913","full_name":"ionite34/base2048","owner":"ionite34","description":"Binary encoding with base-2048 in Python with Rust","archived":false,"fork":false,"pushed_at":"2025-02-17T20:32:02.000Z","size":124,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T09:49:15.847Z","etag":null,"topics":["base-encoding","base2048","encoding","pyo3","python","rust","unicode"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ionite34.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2022-09-17T17:16:25.000Z","updated_at":"2024-05-08T16:55:44.000Z","dependencies_parsed_at":"2023-01-31T02:15:56.317Z","dependency_job_id":"9dea7dda-c22e-4af4-9c6a-705d3e8bedf1","html_url":"https://github.com/ionite34/base2048","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ionite34%2Fbase2048","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ionite34%2Fbase2048/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ionite34%2Fbase2048/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ionite34%2Fbase2048/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ionite34","download_url":"https://codeload.github.com/ionite34/base2048/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243817251,"owners_count":20352525,"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":["base-encoding","base2048","encoding","pyo3","python","rust","unicode"],"created_at":"2024-10-10T19:45:36.268Z","updated_at":"2025-03-16T13:31:28.487Z","avatar_url":"https://github.com/ionite34.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Base 2048 \u0026emsp; [![pypi_badge]][pypi_url] [![versions]][pypi_url]\n\n[build_badge]: https://github.com/ionite34/base2048/actions/workflows/build.yml/badge.svg\n[build_url]: https://github.com/ionite34/base2048/actions/workflows/build.yml\n[versions]: https://img.shields.io/pypi/pyversions/base2048\n[pypi_badge]: https://badge.fury.io/py/base2048.svg\n[pypi_url]: https://pypi.org/project/base2048/\n[twitter_count]: https://developer.twitter.com/en/docs/basics/counting-characters\n[rs_base]: https://github.com/LLFourn/rust-base2048\n[bmp]: https://unicode.org/roadmaps/bmp/\n\n[rtl]: https://wikipedia.org/wiki/Right-to-left_mark\n\n[![build_badge]][build_url]\n[![Rust Tests](https://github.com/ionite34/base2048/actions/workflows/rust-test.yml/badge.svg)](https://github.com/ionite34/base2048/actions/workflows/rust-test.yml)\n[![Python Tests](https://github.com/ionite34/base2048/actions/workflows/py-test.yml/badge.svg)](https://github.com/ionite34/base2048/actions/workflows/py-test.yml)\n\n[![codecov](https://codecov.io/gh/ionite34/base2048/branch/main/graph/badge.svg?token=1Qdx8w3zoy)](https://codecov.io/gh/ionite34/base2048)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ionite34/base2048/main.svg)](https://results.pre-commit.ci/latest/github/ionite34/base2048/main)\n\n### When Base 64 is not enough\n\nAllows up to 11 bits of data per unicode character as counted by\nsocial media and chat platforms such as [Twitter][twitter_count] and Discord.\n\nUses a limited charset within the [Basic Multilingual Plane][bmp].\n\nBased on, and uses a compatible encoding table with the Rust crate [rust-base2048][rs_base].\n\n### - Charset displayable on most locales and platforms\n### - No control sequences, punctuation, quotes, or [RTL][rtl] characters\n\n## Getting Started\n```shell\npip install base2048\n```\n\n```python\nimport base2048\n\nbase2048.encode(b'Hello!')\n# =\u003e 'ϓțƘ໐µ'\n\nbase2048.decode('ϓțƘ໐µ')\n# =\u003e b'Hello!'\n```\n\n### Up to 2x less counted characters compared to Base 64\n\n```python\nimport zlib\nimport base64\n\nimport base2048\n\nstring = ('🐍 🦀' * 1000 + '🐕' * 1000).encode()\ndata = zlib.compress(string)\n\nb64_data = base64.b64encode(data)\n# =\u003e b'eJztxrEJACAQBLBVHNUFBBvr75zvRvgxBEkRSGqvkbozIiIiIiIiIiIiIiIiIiIiIiJf5wAAAABvNbM+EOk='\nlen(b64_data)\n# =\u003e 84\n\nb2048_data = base2048.encode(data)\n# =\u003e 'ը྿Ԧҩ২ŀΏਬйཬΙāಽႩԷ࿋ႬॴŒǔ०яχσǑňॷβǑňॷβǑňॷβǯၰØØÀձӿօĴ༎'\nlen(b2048_data)\n# =\u003e 46\n\nunpacked = zlib.decompress(base2048.decode(b2048_data)).decode()\nlen(unpacked)\n# =\u003e 4000\nunpacked[2000:2002]\n# =\u003e '🦀🐍'\n```\n\n### Decode errors are provided with a character-position of failure\n\n```python\n----\u003e base2048.decode('༗ǥԢΝĒϧǰ༎ǥ')\n\nDecodeError: Unexpected character 8: ['ǥ'] after termination sequence 7: ['༎']\n```\n- To catch the error, use either `base2048.DecodeError` or its base exception, `ValueError`.\n```python\nimport base2048\n\ntry:\n    base2048.decode('🤔')\nexcept base2048.DecodeError as e:\n    print(e)\n```\n\n## License\nThe code in this project is released under the [MIT License](LICENSE).\n\n## Related and prior works\n\u003e Javascript - [base2048](https://github.com/qntm/base2048)\n\n\u003e Rust - [rust-base2048][rs_base]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionite34%2Fbase2048","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fionite34%2Fbase2048","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionite34%2Fbase2048/lists"}