Skip to content

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gem Version Build Status

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.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.

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages