Re: [exim] 30,000+ email accounts

Etusivu
Poista viesti
Vastaa
Lähettäjä: Nico Erfurth
Päiväys:  
Vastaanottaja: exim-users
Kopio: Richard Pickett
Aihe: Re: [exim] 30,000+ email accounts
Philip Hazel schrieb:
> On Tue, 31 Jul 2007, Richard Pickett wrote:
>
>> (a) how do I modify it to pull the first and second character off of the user name to "hash"?
>
> Use one of Exim's built-in "hash" operators. You'll get a more even
> spread than taking the first or even the first two characters. Grep for
> hash in the manual (I'm rushing off now - no time for more).



You'll find them here:

http://www.exim.org/exim-html-current/doc/html/spec_html/ch11.html#SECTexpansionitems

Examples are:
${length_3:${md5:$local_part@$domain}}
${length_3:${sha1:$local_part@$domain}}
${hash_3_26:$local_part@$domain}
${nhash_1000:$local_part@$domain}

All these will return 3 hashed chars, which should be pretty well
distributed. MD5 and SHA1 just return hexadecimal numbers, so you will
have a maximum of 4096 (3^16) different directories. The return value of
hash depends on its second parameter, with this setting you'll get
238328 (62^3) directories (ok, that could be a bit too much *G*). Just
adjust the parameters to something that suits you.
Finally, the nhash-example returns a hashed number between 0 and 1000-1
(the length of the resultstring will not be scaled, so if your result is
99, you will get 99 as a string, not 099)

HTH,
Nico