creditcard-identifier 2.2.0

Credit Card BIN validation using bin-cc data. Identify card brands, validate CVV codes, and check Luhn algorithm.
Documentation
  • Coverage
  • 25%
    10 out of 40 items documented0 out of 8 items with examples
  • Size
  • Source code size: 797.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 16.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 31s Average build duration of successful builds.
  • all releases: 38s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • renatovico/bin-cc
    7 5 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • renatovico

CreditCard Identifier - Rust

Credit Card BIN validation library using bin-cc data.

Installation

Add this to your Cargo.toml:

[dependencies]
creditcard-identifier = "2.1.0"

Usage

use creditcard_identifier::*;

fn main() {
    // Find brand
    let brand = find_brand("4012001037141112");
    println!("{:?}", brand); // Some("visa")
    
    // Check if supported
    let supported = is_supported("4012001037141112");
    println!("{}", supported); // true
    
    // Validate CVV
    let valid_cvv = validate_cvv("123", "visa");
    println!("{}", valid_cvv); // true
    
    // Luhn validation
    let valid_luhn = luhn("4012001037141112");
    println!("{}", valid_luhn); // true
}

Running the Example

cargo run --example example

Testing

# Run tests
cargo test

# Run tests with output
cargo test -- --nocapture

Features

  • Brand Identification: Identify card brand by BIN/IIN patterns
  • CVV Validation: Validate CVV length for each brand
  • Luhn Algorithm: Validate card numbers using Luhn checksum
  • Detailed Brand Info: Get comprehensive brand information
  • Performance: Pre-compiled regex patterns for fast validation
  • Zero-cost abstractions: Compiled with Rust's performance guarantees

Supported Brands

See data/compiled/BRANDS.md for the complete list.

License

MIT License