Multibase.cr
Base transcoder for Base62, Base58, Base85 (RFC 1924), BaseN with multibyte character alphabet support. This library performs byte by byte transcodings and is not compatible with RFC 4648.
Do not use for Base16, Base32, Base64 or basE91
Installation
-
Add the dependency to your
shard.yml
:dependencies: multibase: github: radbas/multibase
-
Run
shards install
Usage
require "multibase"
base62 = Multibase::Base62.encode("Hello World")
p base62 # 73XpUgyMwkGr29M
decoded = Multibase::Base62.decode("73XpUgyMwkGr29M")
p String.new(decoded) # Hello World
# custom transcoder
transcoder = Multibase::Transcoder.new("123456789custom")
# transcoder.encode()
# transcoder.decode()
Contributing
- Fork it (https://github.com/radbas/multibase/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
- Johannes Rabausch - creator and maintainer