in reply to Need and algorithm to converse characters to unique and permanent Serials

It seems to me you want a simple digest hash of the input string. Depending on your needs, Digest::CRC, Digest::MD4, Digest::MD5 or Digest::SHA1 might be interesting for you.

  • Comment on Re: Need and algorithm to converse characters to unique and permanent Serials

Replies are listed 'Best First'.
Re^2: Need and algorithm to converse characters to unique and permanent Serials
by salva (Canon) on Jan 29, 2009 at 10:07 UTC
    The OP asked for unique serials, and those algorithms can not guaranteed that, they just make repetitions unlikely (...I know, the requirements are quite vague).

    If uniquesness is a hard requirement, I think that there are only two possible solutions:

    • Track used serials in a file or database (using DB_File or SQLite, for instance).
    • Make the serials transforming the originals in a way so that no information is lost (an injective transformation). For instance, if the data has some structure, use that knowledge to compress it, and then convert it to a human-friendly format.
      salva,
      Using the DB approach would allow the use of Data::UUID.
      • If input string exists, return key
      • If not, generate new one, store it, return it

      Cheers - L~R