Luhn Algorithm for validating credit cards
en.wikipedia.org
en.wikipedia.org
For a slightly out there and arguably more interesting financial checksum algorithm, and one that is actually amazingly effective, do some statistics on mod97's performance. Realizing how good it was, a few years back for a cool hack in my IBAN library I wrote a mistranscription error suggestion system, which plays off the strengths of mod97. See https://github.com/globalcitizen/php-iban/blob/master/trunk/... and https://github.com/globalcitizen/php-iban/blob/master/trunk/... - for a quick hack, it's amazingly effective.
PS. I am available for remote gigs doing creative or challenging stuff in finance-land at the moment, if anyone appreciates this sort of thing.
I still have some of those files I suppose (downloaded on a dozen floppy disks I carried with me everywhere from cyber café to the other).
For a few years people could get Compuserve access by using a fake number and fake details.
The pages were obviously intended to be used for phishing. However, what really made me go "wow" was the extra mile they went: one of the Javascript files contained methods that took the credit card number from the fake registration page and checked its validity w/ the Luhn algorithm before emailing it to a random email address. If the number was invalid, the user got an error and they forced him to re-enter.
I didn't know about the algorithm at the time (this was around 2005), so I was a bit baffled what the heck they are trying to do.
I understand that perhaps you wouldn't teach programming in ICT, but I'd at least have hoped to learn more about computing generally. The whole thing was just a very sad experience. No one there learnt anything new. Most spent their time playing games or being bored.
The only good thing it taught me was that I was better off teaching myself when it came to computing, at least given the alternatives available to me back then.
Edited to add: The sad thing, for me, is that I chose ICT over a foreign language (I couldn't do both in my school), while I was then top of my class in German and would've liked to continue it. But I didn't, and I'm mildly irritated about that to this day--I'm only now picking up German again. My school offered very little guidance, all things considered, but I took it for granted at the time that that's just how the system worked.
It's a nice one because it is easy to understand and you can TDD it fairly easily.