Daniel Verite wrote:
> That's a permutation, as used in symmetric ciphering. A proven way to
> build one is to use a Feistel network:
Thanks. That looks to be pretty much what I'm after.
> Here is a plpgqsl implementation:
Wow. I really appreciate that. I'll have to test it out and chuck it on
the wiki (if that's OK with you) for future use, alongside whatever I
end up using for my check digit generator and verifier.
Come to think of it, check digits are almost unnecessary; after all, in
a large numeric space the chances of any misheard, typo'd, etc value
happening to be another valid value is pretty minimal. A simple
mod-10-of-sum-of-digits would probably be quite sufficient just to help
the UI differentiate between "Whoops, that number was incorrectly
entered or misheard" and "Customer not found".
--
Craig Ringer