Just Base58 encoder/decoder
-
Add the dependency to your
shard.yml
:dependencies: base58: github: KirillFurtikov/base58
-
Run
shards install
require "base58"
# String, different alphabets
Base58.encode("hello world") # => "rTu1dk6cWsRYjYu"
Base58.encode("hello world", Base58::ALPHABETS[:flickr]) # => "rTu1dk6cWsRYjYu"
Base58.encode("hello world", Base58::ALPHABETS[:bitcoin]) # => "StV1DL6CwTryKyV"
Base58.encode("hello world", Base58::ALPHABETS[:ripple]) # => "StVrDLaUATiyKyV"
# Different source types
source = "hello world" # => "hello world"
source_bytes = source.bytes # => [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
source_slice = source.to_slice # => Bytes[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
Base58.encode(source) # => "rTu1dk6cWsRYjYu"
Base58.encode(source_bytes) # => "rTu1dk6cWsRYjYu"
Base58.encode(source_slice) # => "rTu1dk6cWsRYjYu"
Base58.encode(Bytes[]) # => "1"
int = Base58.encode(1234567890) # => "2T6u2h"
Base58.decode(int) # => 1234567890
- Fork it (https://github.com/KirillFurtikov/base58/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
- Kirill Furtikov - creator and maintainer