checkLuhn is package to assist checking PANs (credit/debit card number) or any other number that uses the Luhn algorithum to validte.
The algorithm is in the public domain and is in wide use today. It is specified in ISO/IEC 7812-1. It is not intended to be a cryptographically secure hash function; it was designed to protect against accidental errors, not malicious attacks. Most credit cards and many government identification numbers use the algorithm as a simple method of distinguishing valid numbers from mistyped or otherwise incorrect numbers.
The issuer
function will can return the Card
Issuer/Scheme and if that scheme is active or not
# The easiest way to get checkLuhn:
install.packages("checkLuhn")
To get a bug fix, or use a feature from the development version, you can install dplyr from GitHub.
# install.packages("devtools")
::install_github("adamjdeacon/checkLuhn") devtools
library(checkLuhn)
# Invalid number
<- "4111 2234 2242 1234"
input checkLuhn(input)
1] FALSE
[
# Valid number
<- "34000000 0000 009"
input checkLuhn(input)
1] TRUE
[
# Check for card type
<- '378282246310005'
input > issuer(input)
# A tibble: 1 x 2
issuer active<chr> <chr>
1 American Express Yes
If you encounter a clear bug, please file a minimal reproducible example on github.