Project

base32-url

0.0
Low commit activity in last 3 years
No release in over a year
32-symbol notation for expressing numbers in a form that can be conveniently and accurately transmitted between humans. URL-friendly version of the base32-crockford gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.11, < 3
>= 11.3, < 14
~> 1.36
~> 0.6.0
= 0.22.0
~> 3.2, >= 3.2.3

Runtime

~> 2.1, >= 2.1.5
 Project Readme

Build Coverage Maintainability Rating Gem Version

An implementation of Douglas Crockfords Base32-Encoding in Ruby, with two modifications to make the resulting strings more URL friendly:

  • use lower case characters
  • use two digits (mod 97-10, ISO 7064) for the checksum

see http://www.crockford.com/wrmg/base32.html

Installation

$ gem install base32-url

Changes

0.6.0 - support Ruby versions beyond 2.x
0.5.0 - use mod 97-10 (ISO 7064) to calculate checksum
0.3.0 - encode into lower case characters, use * ~ _ ^ u for checksum
0.2.0 - added optional checksum

Usage

#!/usr/bin/env ruby

require 'base32/url'

Base32::URL.encode(1234)                            # => "16j"
Base32::URL.encode(100**10, :split=>5, :length=>15) # => "02pqh-ty5nh-h0000"
Base32::URL.decode("2pqh-ty5nh-hoooo")              # => 10**100
Base32::URL.encode(1234, checksum: true)            # => "16j82"
Base32::URL.decode("16j82", checksum: true)          # => 1234

Development

We use test-unit for unit testing:

bundle exec rake

Follow along via Github Issues.

Note on Patches/Pull Requests

  • Fork the project
  • Write tests for your new feature or a test that reproduces a bug
  • Implement your feature or make a bug fix
  • Do not mess with Rakefile, version or history
  • Commit, push and make a pull request. Bonus points for topical branches.

License

base32-url is released under the MIT License.