Hacker News new | past | comments | ask | show | jobs | submit login
Check validity of credit card number (Luhn’s algorithm) (heypub.com)
9 points by WebDev2 on Aug 3, 2012 | hide | past | favorite | 4 comments



During the mid-90s, a high school math teacher gave me extra credit for presenting my class a slight variation of this CC verification algorithm, thus providing a real-world application showing modulo math to be relevant.


anyone able to confirm - is this going to work with all major credit cards?


Yes, this is how it works with all major credit cards as well as many gift cards. You can also find ISO/IEC 7813, the track data standard, on Wikipedia. However, if you're thinking of programming some kind of payment engine, I urge you to carefully research the security and liability issues you are likely to encounter.


thanks, no - no interest just figure this looks simple enough to add as a extra layer of validation before sending card data over the wire...

This example, looks pretty straight forward: https://sites.google.com/site/abapexamples/javascript/luhn-v...




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: