multibase

Version, currently main branch1 version
  • main branchlatestJul 22, 2023

github.com/radbas/multibase.cr

Base transcoder (Base62, Base58, BaseN) with multibyte character alphabet support.

0 stars
1 dependent
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  multibase:
    github: radbas/multibase.cr
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
1.8.2
License
MIT
Author
Johannes Rabausch

Dependencies

Development Dependencies

  • ameba*github: crystal-ameba/amebadev

README

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

  1. Add the dependency to your shard.yml:

    dependencies:
      multibase:
        github: radbas/multibase
  2. 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

  1. Fork it (https://github.com/radbas/multibase/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors