-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 11/23/06 12:38, Sander Steffann wrote: > Hi, > >>> Sure, but the check digit does not need to be stored, as it can be >>> regenerated on demand. The user interface just verifies the check >>> digit, then throws it away. >> >> $ SET GEEZER >> $ WRITE SYS$OUTPUT "THAT'S JUST EXTRA CYCLES WASTED BY THE" >> $ WRITE SYS$OUTPUT "CLIENT. BETTER TO USE THEM FOR SOME OTHER" >> $ WRITE SYS$OUTPUT "MORE PRODUCTIVE PURPOSE." >> $ SET NOGEEZER >> >> That's the VAX/VMS in me oozing out. But seriously, regenerate it >> on demand??? That's not how it works. This isn't a CRC or hash >> function. > > Well, a check digit _is_ a kind of CRC. It is redundant information. For > every number there is only one correct check digit, which means that the > check digit does not add extra information to the number. So why store it? Because it's *part of* the id number. The way we implement it, it's the one's digit. c = f(n) n' = n*10 + c n' is what is stored in id column of the relevant table. This way, if "you" {mistype an id number, it gets garbled in transmission, etc}, it can be algorithmically determined whether or not that is a valid number or not, and only if it is a valid number do you hit the database. Bottom line: check digits are in SSNs and credit card numbers, for a good reason. > You will need to add the check digit on most (all?) output that is > interpreted by humans. The software itself can just use the number > itself (assuming you don't need to check the integrity of the software). > > If you store the number in the database, I would suggest making the db > check the number on all input too. Otherwise you might end up with > invalid data in the database. - -- Ron Johnson, Jr. Jefferson LA USA Is "common sense" really valid? For example, it is "common sense" to white-power racists that whites are superior to blacks, and that those with brown skins are mud people. However, that "common sense" is obviously wrong. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFZiVUS9HxQb37XmcRAhogAKCPp6s995Lm84tUG9TunRvvaFbD8gCcDsv5 18fDxZwV6PrPskRym7hPzHs= =ON0M -----END PGP SIGNATURE-----