Table of Contents
- Features
- Installation
- Usage
- API Reference
- Input Validation
- Testing
- Continuous Integration (CI)
- Contributing
- License
- Disclaimer
Features
- Generate valid credit card numbers using the Luhn algorithm
- Customizable BIN patterns (with support for 'x' wildcards)
- Specify or randomize expiration month, year, and CVV
- Generate single or multiple cards at once
- Input validation for all fields
- Designed for easy integration and extension
- Comprehensive test suite
Installation
Add ccgen_rs to your Cargo.toml:
[]
= "0.1.0"
Usage
Basic Example
use ;
let opts = GeneratorOptions ;
let cards = Generate_Cards;
for card in cards
Randomized Example
let opts = GeneratorOptions ;
let cards = Generate_Cards;
API Reference
GeneratorOptions
CardInfo
Generate_Cards
- Returns a vector of generated cards based on the provided options.
- Returns an empty vector if input is invalid (e.g., bad BIN pattern, out-of-range month/year/cvv).
Input Validation
bin_patternmust be 16 or fewer characters, only digits or 'x'.monthmust be 1-12.yearmust be 2025-2050.cvvmust be 0-999.- Invalid input returns an empty vector.
Testing
Run the test suite with:
The project includes 22+ tests covering edge cases, input validation, and Luhn compliance.
Continuous Integration (CI)
This project uses GitHub Actions for CI. Two workflows are provided:
- Cargo Test Workflow: Runs
cargo teston every push and pull request to ensure all tests pass. - Cargo Build Workflow: Runs
cargo buildto verify the project builds successfully.
You can find these workflows in .github/workflows/.
Contributing
Contributions are welcome! Please open issues or submit pull requests for bug fixes, new features, or improvements.
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request
License
This project is licensed under the MIT License. See LICENSE for details.
Disclaimer
This library is for testing and development purposes only. Do not use generated card numbers for fraudulent or illegal activities.