https://github.com/barseghyanartur/rebus
Generate base64-encoded strings consisting of alphanumeric symbols only. https://pypi.python.org/pypi/rebus
https://github.com/barseghyanartur/rebus
base64 base64-decoding base64-encoding python
Last synced: 9 months ago
JSON representation
Generate base64-encoded strings consisting of alphanumeric symbols only. https://pypi.python.org/pypi/rebus
- Host: GitHub
- URL: https://github.com/barseghyanartur/rebus
- Owner: barseghyanartur
- Created: 2013-12-19T23:54:42.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-03-14T15:14:32.000Z (over 12 years ago)
- Last Synced: 2025-09-23T16:44:50.539Z (9 months ago)
- Topics: base64, base64-decoding, base64-encoding, python
- Language: Python
- Homepage: https://pypi.python.org/pypi/rebus
- Size: 199 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE_GPL2.0.txt
Awesome Lists containing this project
README
===============================================
rebus
===============================================
Generate base64-encoded strings consisting of alphanumeric symbols only.
Why did I make this app?
===============================================
Recently I have been working on implementing of a `Google Authenticator `_ app for Plone (which I
did for my beloved company - `Goldmund, Wyldebeast & Wunderliebe `_).
For generating of a bar code image, I needed a base32 encoded string. While Android
devices could perfectly scan all bar-code image that I would generate, Apple devices
would raise errors on bar code images which were generated using strings that contain
one or more "=" characters.
The solution found was to add a number of \\n at the end of the string to be encoded.
If you happen to experience similar problems, you know what to do.
Prerequisites
===============================================
- Python 2.6.8+, 2.7.+, 3.3.+
Installation
===============================================
Install latest stable version from PyPI:
$ pip install rebus
...or latest stable version from GitHub:
$ pip install -e git+https://github.com/barseghyanartur/rebus@stable#egg=rebus
...or latest stable version from BitBucket:
$ pip install -e hg+https://bitbucket.org/barseghyanartur/rebus@stable#egg=rebus
Usage and examples
===============================================
Using `rebus` is damn easy. Whenever you would want to use ``base64.b32encode``
or ``base64.b64encode``, replace `base64` with `rebus`.
Encoding
-----------------------------------------------
Required imports
>>> import rebus
b32encode string
>>> rebus.b32encode('abcdefg')
'MFRGGZDFMZTQUCQK'
b64encode string
>>> rebus.b64encode('abcdefg')
'YWJjZGVmZwoK'
urlsafe_b64encode
>>> rebus.urlsafe_b64encode('abcdefg')
'YWJjZGVmZwoK'
Decoding
-----------------------------------------------
It's possible to decode string, encoded with `rebus` to their original values.
Required imports
>>> import rebus
b32decode string
>>> rebus.b32decode('MFRGGZDFMZTQUCQK')
'abcdefg'
b64decode string
>>> rebus.b64decode('YWJjZGVmZwoK')
'abcdefg'
urlsafe_b64encode
>>> rebus.urlsafe_b64decode('YWJjZGVmZwoK')
'abcdefg'
License
===============================================
GPL 2.0/LGPL 2.1
Support
===============================================
For any issues contact me at the e-mail given in the `Author` section.
Author
===============================================
Artur Barseghyan