base56


Namebase56 JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryEncode and decode base56 data.
upload_time2024-12-30 19:08:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseGPL-3.0
keywords base56 decode encode encoding
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # base56

Human-readable binary encoding base56.

> Base56 is a variant of [Base58] encoding which further sheds the '1' and the lowercase 'o' characters in order to minimise the risk of fraud and human-error.
>
> [Base58]  is similar to [Base64], but modified to avoid both non-alphanumeric characters (+ and /) and
> letters that might look ambiguous when printed (0 – zero, I – capital i, O – capital o and l – lower-case L).
> Base58 is used to represent bitcoin addresses.[citation needed] Some messaging and social media systems break lines on non-alphanumeric strings. This is avoided by not using URI reserved characters such as +.

See also:

- [Binary-to-text_encoding](https://en.wikipedia.org/wiki/Binary-to-text_encoding)
- [jyn514/base56](https://github.com/jyn514/base56/)
- [baseconv](https://pypi.org/project/python-baseconv/)

[Base58]: https://en.wikipedia.org/wiki/Base58
[Base64]: https://en.wikipedia.org/wiki/Base64

## Technical details

`base56` translates the binary values from 0-55 to their counterpart
in the following alphabet:
`23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz`

## Usage

```python
>>> from base56 import b56encode, b56decode
>>> b56encode(b"Hello World!")
'JjTDmGcemeMrgbs73'
>>> b56decode('JjTDmGcemeMrgbs73')
b'Hello World!'

```

### Compatibility

We have different alphabets defined because the Go package and other packages
use different alphabets.

```python
>>> from base56 import PY3, GO_STD, GO_ALT, DEFAULT
>>> DEFAULT == PY3
True
>>> DEFAULT
Alphabet(b'23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz')
>>> DEFAULT.b56encode(b"Hello World!") # same as above
'JjTDmGcemeMrgbs73'
>>> GO_STD.b56decode(GO_STD.b56encode(b"Hello World!")) # from the Go implementation
b'Hello World!'
>>> GO_ALT.b56decode(GO_ALT.b56encode(b"Hello World!")) # from the PHP/Java implementation
b'Hello World!'

```

### Skipping Characters

Characters that are not in the set can be skipped.
By default, space characters are skipped.

```python
>>> b56decode('JjTDm    GcemeMrgbs73\n')
b'Hello World!'
>>> b56decode('JjTDm    GcemeMrgbs73\n', skip=" \n")
b'Hello World!'

```

### Ambiguity

If characters are ambiguous, they will be treated as the same characters.
This only happens if they are included in the alphabet.

```python
>>> GO_STD.decode("o2")  # lowercase letter o
b'p'
>>> GO_STD.decode("02")  # zero
b'p'
>>> GO_STD.decode("O2")  # capital letter o
b'p'
>>> GO_STD.decode("12")  # one
b'q'
>>> GO_STD.decode("I2")  # capital letter i
b'q'

```

## Development

This project is created with tests.
To run them, install `tox`.

```sh
tox
```

To create a new release, push a new tag.

```sh
git tag v0.1.0
git push origin v0.1.0
```

## Changelog

- v0.1.1: Add ambiguity support for decoding
- v0.1.0: Initial release: Alphabets, encode, decode

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "base56",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Nicco Kunzmann <niccokunzmann@rambler.ru>",
    "keywords": "base56, decode, encode, encoding",
    "author": null,
    "author_email": "Nicco Kunzmann <niccokunzmann@rambler.ru>",
    "download_url": "https://files.pythonhosted.org/packages/49/f2/c8832eb56bb28f2e415a153e4807457401dd7daa1396b75b6a04b5473907/base56-0.1.1.tar.gz",
    "platform": null,
    "description": "# base56\n\nHuman-readable binary encoding base56.\n\n> Base56 is a variant of [Base58] encoding which further sheds the '1' and the lowercase 'o' characters in order to minimise the risk of fraud and human-error.\n>\n> [Base58]  is similar to [Base64], but modified to avoid both non-alphanumeric characters (+ and /) and\n> letters that might look ambiguous when printed (0 \u2013 zero, I \u2013 capital i, O \u2013 capital o and l \u2013 lower-case L).\n> Base58 is used to represent bitcoin addresses.[citation needed] Some messaging and social media systems break lines on non-alphanumeric strings. This is avoided by not using URI reserved characters such as +.\n\nSee also:\n\n- [Binary-to-text_encoding](https://en.wikipedia.org/wiki/Binary-to-text_encoding)\n- [jyn514/base56](https://github.com/jyn514/base56/)\n- [baseconv](https://pypi.org/project/python-baseconv/)\n\n[Base58]: https://en.wikipedia.org/wiki/Base58\n[Base64]: https://en.wikipedia.org/wiki/Base64\n\n## Technical details\n\n`base56` translates the binary values from 0-55 to their counterpart\nin the following alphabet:\n`23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz`\n\n## Usage\n\n```python\n>>> from base56 import b56encode, b56decode\n>>> b56encode(b\"Hello World!\")\n'JjTDmGcemeMrgbs73'\n>>> b56decode('JjTDmGcemeMrgbs73')\nb'Hello World!'\n\n```\n\n### Compatibility\n\nWe have different alphabets defined because the Go package and other packages\nuse different alphabets.\n\n```python\n>>> from base56 import PY3, GO_STD, GO_ALT, DEFAULT\n>>> DEFAULT == PY3\nTrue\n>>> DEFAULT\nAlphabet(b'23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz')\n>>> DEFAULT.b56encode(b\"Hello World!\") # same as above\n'JjTDmGcemeMrgbs73'\n>>> GO_STD.b56decode(GO_STD.b56encode(b\"Hello World!\")) # from the Go implementation\nb'Hello World!'\n>>> GO_ALT.b56decode(GO_ALT.b56encode(b\"Hello World!\")) # from the PHP/Java implementation\nb'Hello World!'\n\n```\n\n### Skipping Characters\n\nCharacters that are not in the set can be skipped.\nBy default, space characters are skipped.\n\n```python\n>>> b56decode('JjTDm    GcemeMrgbs73\\n')\nb'Hello World!'\n>>> b56decode('JjTDm    GcemeMrgbs73\\n', skip=\" \\n\")\nb'Hello World!'\n\n```\n\n### Ambiguity\n\nIf characters are ambiguous, they will be treated as the same characters.\nThis only happens if they are included in the alphabet.\n\n```python\n>>> GO_STD.decode(\"o2\")  # lowercase letter o\nb'p'\n>>> GO_STD.decode(\"02\")  # zero\nb'p'\n>>> GO_STD.decode(\"O2\")  # capital letter o\nb'p'\n>>> GO_STD.decode(\"12\")  # one\nb'q'\n>>> GO_STD.decode(\"I2\")  # capital letter i\nb'q'\n\n```\n\n## Development\n\nThis project is created with tests.\nTo run them, install `tox`.\n\n```sh\ntox\n```\n\nTo create a new release, push a new tag.\n\n```sh\ngit tag v0.1.0\ngit push origin v0.1.0\n```\n\n## Changelog\n\n- v0.1.1: Add ambiguity support for decoding\n- v0.1.0: Initial release: Alphabets, encode, decode\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "Encode and decode base56 data.",
    "version": "0.1.1",
    "project_urls": {
        "Changelog": "https://github.com/foss-fund/base56/#changelog",
        "Documentation": "https://github.com/foss-fund/base56/",
        "Homepage": "https://github.com/foss-fund/base56/",
        "Issues": "https://github.com/foss-fund/base56/issues",
        "Repository": "https://github.com/foss-fund/base56/",
        "source_archive": "https://github.com/foss-fund/base56/archive/59cc3f7c8718febf1b5b0a8a3b5d350544ddfe2d.zip"
    },
    "split_keywords": [
        "base56",
        " decode",
        " encode",
        " encoding"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b5f9363512a93f86cde2d03d25042d0476fde2dd22e41781769e11975c2c4ea6",
                "md5": "b43ec2ef8cd4d60a515498ea2b427adf",
                "sha256": "2c7ed0bdbefa2bec31f066c194b77b84706ad7cd1bfffdb0d21101ef4f395460"
            },
            "downloads": -1,
            "filename": "base56-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b43ec2ef8cd4d60a515498ea2b427adf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 22647,
            "upload_time": "2024-12-30T19:07:59",
            "upload_time_iso_8601": "2024-12-30T19:07:59.693560Z",
            "url": "https://files.pythonhosted.org/packages/b5/f9/363512a93f86cde2d03d25042d0476fde2dd22e41781769e11975c2c4ea6/base56-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49f2c8832eb56bb28f2e415a153e4807457401dd7daa1396b75b6a04b5473907",
                "md5": "dcc544b73144f5d0f1f919ec243e015b",
                "sha256": "2f96cbe8d46c96a86b320cc44377f11f429cadd4969a44d3e40320cfe8efb592"
            },
            "downloads": -1,
            "filename": "base56-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dcc544b73144f5d0f1f919ec243e015b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 21521,
            "upload_time": "2024-12-30T19:08:00",
            "upload_time_iso_8601": "2024-12-30T19:08:00.828362Z",
            "url": "https://files.pythonhosted.org/packages/49/f2/c8832eb56bb28f2e415a153e4807457401dd7daa1396b75b6a04b5473907/base56-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-30 19:08:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "foss-fund",
    "github_project": "base56",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "base56"
}
        
Elapsed time: 0.59223s