creditcard-identifier

Crates.iocreditcard-identifier
lib.rscreditcard-identifier
version2.3.0
created_at2026-01-12 10:33:34.202926+00
updated_at2026-01-15 00:52:33.640967+00
descriptionCredit Card BIN validation using bin-cc data. Identify card brands, validate CVV codes, and check Luhn algorithm.
homepagehttps://github.com/renatovico/bin-cc/tree/master/libs/rust
repositoryhttps://github.com/renatovico/bin-cc
max_upload_size
id2037448
size41,995,948
Renato Viço (renatovico)

documentation

https://docs.rs/creditcard-identifier

README

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

Commit count: 144

cargo fmt