Names to ids

Andy Armstrong andy at hexten.net
Wed Jan 25 13:56:13 GMT 2006


On 25 Jan 2006, at 13:40, Simon Wistow 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.

Is your numeric id allowed to be longer than 32 bits? If not the  
first eight characters will do fine - you only have a 32 bit  
numberspace to use anyway. If not what (if any) length constraints  
does the numeric id have?

-- 
Andy Armstrong, hexten.net



More information about the london.pm mailing list