MyNixOS website logo
Description

Checks if a Number is Valid Using the Luhn Algorithm.

Confirms if the number is Luhn compliant. Can check if credit card, IMEI number or any other Luhn based number is correct. For more info see: <https://en.wikipedia.org/wiki/Luhn_algorithm>.

CheckLuhn

Build Status AppVeyor Build Status Coverage Status Rdoc

Overview

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

Installation

# The easiest way to get checkLuhn:
install.packages("checkLuhn")

Development version

To get a bug fix, or use a feature from the development version, you can install dplyr from GitHub.

# install.packages("devtools")
devtools::install_github("adamjdeacon/checkLuhn")

Usage

library(checkLuhn)

# Invalid number
input <- "4111 2234 2242 1234"
checkLuhn(input)
[1] FALSE

# Valid number
input <- "34000000 0000 009"
checkLuhn(input)
[1] TRUE

# Check for card type
input <- '378282246310005'
> issuer(input)
# A tibble: 1 x 2
  issuer           active
  <chr>            <chr> 
1 American Express Yes  

Getting help

If you encounter a clear bug, please file a minimal reproducible example on github.

Metadata

Version

1.1.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows