Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Latest commit

 

History

History
51 lines (38 loc) · 1.02 KB

README.md

File metadata and controls

51 lines (38 loc) · 1.02 KB

Luhn algorithm in Elixir

hex.pm version hex.pm daily downloads hex.pm weekly downloads hex.pm downloads Build Status

Validate Luhn number.

Installation

# mix.exs
defp deps do
  [
    {:luhn, "~> 0.5.1"}
  ]
end

# and fetch
$ mix deps.get

How to use

# validate number
Luhn.valid? "378282246310005"
# => true

# Integer type number
Luhn.valid? 378282246310005
# => true

# Luhn base 16 mod 10
Luhn.valid? "0F04871513130338972614312C30307", 16, 10
# => true

Benchmarking

$ MIX_ENV=bench mix deps.get
$ MIX_ENV=bench mix compile
$ mix bench

LICENSE

MIT