Skip to content

JorgeLeites/ruby-luhn

Repository files navigation

ruby-luhn

A lightweight implementation of the Luhn algorithm.

Gem Version

Installation

This gem is available in RubyGems. To install add the following to your Gemfile:

gem 'ruby-luhn'

And run bundle install.

Usage

To generate the checksum for a number you can simply do

Luhn.generate('12345')

It uses base 10 by default, but you can change that easily:

Luhn.generate('123ABC', base: 16)

License

The MIT License (MIT)

Copyright (c) 2020 Jorge Leites

About

A lightweight implementation of the Luhn algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages