Skip to content

steventen/base62-rb

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Base62 in Ruby

Build Status

A simple and fast implementation of base62 in pure Ruby without too much sugar and magic.

It uses character set: 0-9, a-z, A-Z for encoding and decoding.

Base62 is usually used for short URLs.

Installation

Add this line to your application's Gemfile:

gem 'base62-rb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install base62-rb

Usage

require 'base62-rb'

Base62.encode(3781504209452600)
# => "hjNv8tS3K"

Base62.decode("hjNv8tS3K")
# => 3781504209452600

Benchmark

See the comparison here

License

MIT License - Copyright (c) 2016 Steven Yue

About

Fast Base62 encoding and decoding in Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages