A lightweight implementation of the Luhn algorithm.
This gem is available in RubyGems. To install add the following to your Gemfile:
To generate the checksum for a number you can simply do
It uses base 10 by default, but you can change that easily:
Luhn.generate('123ABC', base: 16)
The MIT License (MIT)
Copyright (c) 2020 Jorge Leites