Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 587 Bytes

README.md

File metadata and controls

35 lines (21 loc) · 587 Bytes

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