{"id":16641105,"url":"https://github.com/suminb/base62","last_synced_at":"2025-04-06T06:10:21.821Z","repository":{"id":8018565,"uuid":"9427425","full_name":"suminb/base62","owner":"suminb","description":"Python module for base62 encoding; a URL-safe encoding for arbitrary data","archived":false,"fork":false,"pushed_at":"2024-02-02T02:51:06.000Z","size":99,"stargazers_count":77,"open_issues_count":4,"forks_count":15,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-03-30T05:05:57.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suminb.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","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":"2013-04-14T10:14:54.000Z","updated_at":"2025-02-20T08:41:50.000Z","dependencies_parsed_at":"2024-06-18T16:54:37.844Z","dependency_job_id":"204afac2-f131-43eb-983f-882db5dc12f2","html_url":"https://github.com/suminb/base62","commit_stats":{"total_commits":98,"total_committers":8,"mean_commits":12.25,"dds":"0.29591836734693877","last_synced_commit":"1361dbad019d8cefd9543df54517f19adab82030"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suminb%2Fbase62","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suminb%2Fbase62/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suminb%2Fbase62/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suminb%2Fbase62/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suminb","download_url":"https://codeload.github.com/suminb/base62/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441053,"owners_count":20939239,"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":[],"created_at":"2024-10-12T07:45:17.141Z","updated_at":"2025-04-06T06:10:21.805Z","avatar_url":"https://github.com/suminb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"base62\n======\n\n|Build Status| |Coveralls| |PyPI|\n\nA Python module for ``base62`` encoding. Ported from PHP code that I wrote\nin mid-2000, which can be found\n`here \u003chttp://philosophical.one/posts/base62\u003e`__.\n\n.. |Build Status| image:: https://github.com/suminb/base62/actions/workflows/ci.yml/badge.svg\n   :target: https://github.com/suminb/base62/actions/workflows/ci.yml?query=branch%3Adevelop\n.. |PyPI| image:: https://img.shields.io/pypi/v/pybase62.svg\n   :target: https://pypi.python.org/pypi/pybase62\n.. |Coveralls| image:: https://coveralls.io/repos/github/suminb/base62/badge.svg?branch=master\n   :target: https://coveralls.io/github/suminb/base62?branch=develop\n\n\nRationale\n---------\n\nWhen writing a web application, often times we would like to keep the URLs\nshort.\n\n::\n\n    http://localhost/posts/V1Biicwt\n\nThis certainly gives a more concise look than the following.\n\n::\n\n    http://localhost/posts/109237591284123\n\nThis was the original motivation to write this module, but there shall be much\nmore broader potential use cases of this module. The main advantage of\n``base62`` is that it is URL-safe (as opposed to ``base64``) due to the lack of\nspecial characters such as '``/``' or '``=``'. Another key aspect is that the\nalphabetical orders of the original (unencoded) data is preserved when encoded.\nIn other words, encoded data can be sorted without being decoded at all.\n\nInstallation\n============\n\n``base62`` can be installed via ``pypi``. Unfortunately, the package name\n``base62`` on ``pypi`` had already been occupied by someone else, so we had to\ngo by ``pybase62``.\n\n::\n\n    pip install pybase62\n\nAlternatively, you may clone the code to manually install it.\n\n::\n\n    git clone https://github.com/suminb/base62\n    cd base62 \u0026\u0026 python setup.py install\n\nUsage\n=====\n\nThe following section describes a basic usage of ``base62``.\n\n.. code:: python\n\n    \u003e\u003e\u003e import base62\n\n    \u003e\u003e\u003e base62.encode(34441886726)\n    'base62'\n\n    \u003e\u003e\u003e base62.decode('base62')\n    34441886726\n\nFrom version ``0.2.0``, ``base62`` supports ``bytes`` array encoding as well.\n\n.. code:: python\n\n    \u003e\u003e\u003e base62.encodebytes(b'\\0')\n    0\n\n    \u003e\u003e\u003e base62.encodebytes(b'\\xff\\xff')\n    H31\n\n    \u003e\u003e\u003e base62.decodebytes('0')\n    b''\n\n    \u003e\u003e\u003e base62.decodebytes('1')\n    b'\\x01'\n\nSome may be inclined to assume that they both take ``bytes`` types as input\ndue to their namings. However, ``encodebytes()`` takes ``bytes`` types\nwhereas ``decodebytes()`` takes ``str`` types as an input. They are intended\nto be commutative, so that a *roundtrip* between both functions yields the\noriginal value.\n\nFormally speaking, we say function *f* and *g* commute if *f∘g* = *g∘f* where\n*f(g(x))* = *(f∘g)(x)*.\n\nTherefore, we may expect the following relationships:\n\n* ``value == encodebytes(decodebytes(value))``\n* ``value == decodebytes(encodebytes(value))``\n\nTests\n=====\n\nYou may run some test cases to ensure all functionalities are operational.\n\n::\n\n    pytest -v\n\nIf ``pytest`` is not installed, you may want to run the following command:\n\n::\n\n    pip install -r tests/requirements.txt\n\n\nDeployment\n==========\n\nDeploy a source package (to `pypi \u003chttps://pypi.org\u003e`_) as follows:\n\n::\n\n    python setup.py sdist upload\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuminb%2Fbase62","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuminb%2Fbase62","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuminb%2Fbase62/lists"}