Skip to content

jatiinyadav/luhn-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Credit Card Checksum Validation 🏦

This repository contains implementations of a credit card checksum validation algorithm across multiple programming languages. The algorithm used is the Luhn algorithm, which is commonly employed to validate credit card numbers.

Algorithm Overview 🔍

The Luhn algorithm (or "modulus 10" algorithm) is a simple checksum formula used to validate various identification numbers, especially credit card numbers. The algorithm works by:

  1. Doubling every second digit from the right (starting with the second-to-last digit) 🔢.
  2. Subtracting 9 from any result that is greater than 9 ✂️.
  3. Summing all the digits ➕.
  4. Checking if the total sum is divisible by 10 🔄.
  5. If the total sum is divisible by 10, the credit card number is considered valid ✅.

Implementations 🛠️

This repository includes implementations of the Luhn algorithm in the following programming languages:

  • Python 🐍
  • Java ☕
  • C# 🔧
  • JavaScript 💎
  • Go 🚀
  • Rust 🦀

Each implementation provides a function to validate a credit card number using the Luhn algorithm.

Contributing 🤝

Contributions to improve or add new language implementations are welcome. Please feel free to submit pull requests or open issues if you encounter any problems or have suggestions for enhancements.