{"id":20924182,"url":"https://github.com/hashberg-io/bases","last_synced_at":"2025-05-13T16:30:59.870Z","repository":{"id":57414045,"uuid":"417646762","full_name":"hashberg-io/bases","owner":"hashberg-io","description":"A Python library for general Base-N encodings.","archived":false,"fork":false,"pushed_at":"2023-12-18T17:54:18.000Z","size":909,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-11T13:48:09.642Z","etag":null,"topics":["base-n","base32","base58","base64","python"],"latest_commit_sha":null,"homepage":"https://bases.readthedocs.io","language":"Python","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/hashberg-io.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2021-10-15T21:55:55.000Z","updated_at":"2024-09-29T00:42:31.000Z","dependencies_parsed_at":"2022-08-29T15:23:02.934Z","dependency_job_id":null,"html_url":"https://github.com/hashberg-io/bases","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Fbases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Fbases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Fbases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hashberg-io%2Fbases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hashberg-io","download_url":"https://codeload.github.com/hashberg-io/bases/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981702,"owners_count":21994318,"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-n","base32","base58","base64","python"],"created_at":"2024-11-18T20:19:54.683Z","updated_at":"2025-05-13T16:30:54.860Z","avatar_url":"https://github.com/hashberg-io.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"bases: A Python library for Base-N encodings\n============================================\n\n.. image:: https://img.shields.io/badge/python-3.7+-green.svg\n    :target: https://docs.python.org/3.7/\n    :alt: Python versions\n\n.. image:: https://img.shields.io/pypi/v/bases.svg\n    :target: https://pypi.python.org/pypi/bases/\n    :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/status/bases.svg\n    :target: https://pypi.python.org/pypi/bases/\n    :alt: PyPI status\n\n.. image:: http://www.mypy-lang.org/static/mypy_badge.svg\n    :target: https://github.com/python/mypy\n    :alt: Checked with Mypy\n    \n.. image:: https://readthedocs.org/projects/bases/badge/?version=latest\n    :target: https://bases.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://github.com/hashberg-io/bases/actions/workflows/python-pytest.yml/badge.svg\n    :target: https://github.com/hashberg-io/bases/actions/workflows/python-pytest.yml\n    :alt: Python package status\n\n.. image:: https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square\n    :target: https://github.com/RichardLitt/standard-readme\n    :alt: standard-readme compliant\n\n\nBases provides a customisable, parametric implementation of several common styles of Base-N encoding, covering all cases appearing in the `multibase specification \u003chttps://github.com/multiformats/multibase\u003e`_ (except for proquints).\n\n\n.. contents::\n\n\nInstall\n-------\n\nYou can install the latest release from `PyPI \u003chttps://pypi.org/project/bases/\u003e`_ as follows:\n\n.. code-block:: console\n\n    $ pip install --upgrade bases\n\n\nUsage\n-----\n\nWe suggest you import bases as follows:\n\n\u003e\u003e\u003e import bases\n\n\nBelow are some basic usage examples, to get you started: for detailed documentation, see https://bases.readthedocs.io/\n\n\nBase encoding objects\n^^^^^^^^^^^^^^^^^^^^^\n\n\u003e\u003e\u003e from bases import base32\n\u003e\u003e\u003e base32\nFixcharBaseEncoding(\n    StringAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n                   case_sensitive=False),\n    pad_char='=', padding='include')\n\n\nEncoding\n^^^^^^^^\n\n\u003e\u003e\u003e b = bytes([70, 98, 190, 187, 66, 224, 178])\n\u003e\u003e\u003e base32.encode(b)\n'IZRL5O2C4CZA===='\n\n\nDecoding\n^^^^^^^^\n\n\u003e\u003e\u003e s = 'IZRL5O2C4CZA===='\n\u003e\u003e\u003e base32.decode(s)\nb'Fb\\xbe\\xbbB\\xe0\\xb2'\n\u003e\u003e\u003e list(base32.decode(s))\n[70, 98, 190, 187, 66, 224, 178]\n\n\nCase/padding variations\n^^^^^^^^^^^^^^^^^^^^^^^\n\n\u003e\u003e\u003e b = bytes([70, 98, 190, 187, 66, 224, 178])\n\u003e\u003e\u003e base32.encode(b)\n'IZRL5O2C4CZA===='\n\u003e\u003e\u003e base32lower = base32.lower()\n\u003e\u003e\u003e base32lower\nFixcharBaseEncoding(\n    StringAlphabet('abcdefghijklmnopqrstuvwxyz234567',\n                   case_sensitive=False),\n    pad_char='=', padding='include')\n\u003e\u003e\u003e base32lower.encode(b)\n'izrl5o2c4cza===='\n\u003e\u003e\u003e base32nopad = base32.nopad()\n\u003e\u003e\u003e base32nopad.encode(b)\n'IZRL5O2C4CZA'\n\n\nCase sensitivity variations\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n\u003e\u003e\u003e s = 'IZRL5O2C4CZA===='\n\u003e\u003e\u003e base32lower.decode(s)\nb'Fb\\xbe\\xbbB\\xe0\\xb2'\n\u003e\u003e\u003e base32lower_casesensitive = base32lower.with_case_sensitivity(True)\n\u003e\u003e\u003e base32lower_casesensitive.decode(s)\nbases.encoding.errors.NonAlphabeticCharError: Invalid character 'I'\nencountered for alphabet StringAlphabet('abcdefghijklmnopqrstuvwxyz234567').\n\n\nCustom base encodings\n^^^^^^^^^^^^^^^^^^^^^\n\n\u003e\u003e\u003e base4 = bases.make(\"0123\", kind=\"zeropad-enc\", block_nchars=4)\n\u003e\u003e\u003e base4\nZeropadBaseEncoding(StringAlphabet('0123'), block_nchars=4)\n\n\n\nAPI\n---\n\nFor the full API documentation, see https://bases.readthedocs.io/\n\n\nContributing\n------------\n\nPlease see `\u003cCONTRIBUTING.md\u003e`_.\n\n\nLicense\n-------\n\n`MIT © Hashberg Ltd. \u003cLICENSE\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashberg-io%2Fbases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhashberg-io%2Fbases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhashberg-io%2Fbases/lists"}