base32_pure
Encodes and decodes binary string or integer tokens to and from base32.
Based on wrimle's base32_pure library
Description
It uses the Crockford alphabet defined at http://www.crockford.com/wrmg/base32.html - which is probably not the most efficient, but it is tolerant to user mistakes.
- It's case insensitive
- I, l and 1 maps to the same value
- 0 and O maps to the same value
- U is excluded to reduce the likelyhood of accidental obscenity
Installation
-
Add the dependency to your
shard.yml
:dependencies: base32_pure: github: whaxion/base32_pure
-
Run
shards install
Usage
/!\ Doesn't work with integer and hypenation /!\
require "base32_pure"
encoded = Base32::Crockford.encode("Some token")
Base32::Crockford.decode(encoded)
Contributing
- Fork it (https://github.com/whaxion/base32_pure/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Whaxion - creator and maintainer