in reply to Need and algorithm to converse characters to unique and permanent Serials
The only ways I can think of getting unique serials out of a user name are:
You could use something like a CRC or a digest (like MD5), but clashes, however unlikely, are still theoretically a possibility, so you'd still have to store it. BTW you can append a secret key string to the user supplied value, before processing, to get a more unpredictable output.
using reversible encryption. That way you cannot get clashes, but the result will likely be at least as long as the user supplied name, bar compression. You can use something as simple as ROT13, but if people mustn't be able to reverse engineer it too easily, use one of the more elaborate encryption schemes, with a password (AKA encryption key).
If user names are sufficiently small, you may get by with just using a block cipher algorithm, i.e. virtually any encryption algorithm available, and just use a single cipher block. In that case, you're commonly limited to string of for example 8 bytes long. I'm not sure the latter is actually worth investigating, but most likely, as a result, you'll get serials with a more predictable length.
For example, the module Crypt::CAST5 (or Crypt::CAST5_PP, if it must be Pure Perl) looks usable to me, straight out of the box.
|
|---|