Names to ids

Chris Carline chris.carline at gmail.com
Wed Jan 25 13:56:01 GMT 2006


On 1/25/06, Simon Wistow <simon at thegestalt.org> wrote:
> I need to turna filename into a numeric id in a repeatable manner (i.e
> the same filename must always produce the same number).
>
> My first thought (md5_hex the name and then hex the reuslt to get an
> integer) gets an overflow error unless I truncate to the first 8
> characters.
>
> String::KoreMutake doesn't work because it can only taken certain
> phonemes.
>
> Any ideas?

Does this need to be reversible?

Why not just substitute each character for a number (e.g. ASCII
decimal codes) and concatenate them? Might be a bit more of a problem
if you're expecting unicode file names, of course...



More information about the london.pm mailing list