Has anyone worked with the LUHN algorithm?
Don M
Posts: 1,652
Here's a link for a description- http://en.wikipedia.org/wiki/Luhn_algorithm
Looking to see if anyone has written any methods using it. A forum search only turned up someone with the last name of Luhn.
Thanks.
Don
Looking to see if anyone has written any methods using it. A forum search only turned up someone with the last name of Luhn.
Thanks.
Don
Comments
More likely we would use a simple checksum or Cyclic Redundancy Check for verifying binary data in storage devices or communications protocols.
http://en.wikipedia.org/wiki/Cyclic_redundancy_check
The following code seems to work. It validated correct the example number in the Wiki and also my own CreditCard number.
Andy
Thanks Jon. I'll look for that article as well.
Andy- Thanks for your demo. I'm trying to understand what you are looking for here:
I like your simple code that uses backspace to correct mistakes typed but I'm trying to figure out what you are looking for. I know the "8" is the backspace character but what does the $C8 ("200") represent?
$C8 is the code that the PS2 Keyboard driver returns for the Backspace key. I normally use PropTerminal on the PC to test such Spin code and PropTerminal sends key codes compatible to the PS2 keyboard driver. If I test for $C8 and 8 then the same code works with standard Terminals and PropTerminal (and PS2 keybords when you change ser.rx to kbrd.getkey).
Andy