Re: [EXIM] formated hash function

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: yann.golanski
CC: EXIM users list
Subject: Re: [EXIM] formated hash function
On Mon, 21 Jun 1999 yann.golanski@??? wrote:

> This is a patch to exim-3.02 that adds one function to the expand.c
> routines.
>
> The function is a `formated hash' (fh) that takes a number of options:
>    ${formatedhash_retval_sept_hrange_str}
> where
>    retval is an int, defining the number of output returned. Should be
>           smaller than 100.
>    sept   is a list of characters, separated by `;', that will be used
>           to separate the hashed part. 
>    hrange is a list of ints, separated by `;', that is the range of
>           the hash. 
>    str    is the string that will be hashed. 


Thanks for the submission, but I have several comments:

(1) Is this a replacement for, or in addition to, the previous new hash
function you supplied?

(2) The syntax of all other expansion operators uses a colon before the
string to be operated on, but you have used an underscore. I don't like
the inconsistency.

(3) This function returns a small number; is there any good reason why
this is any better than a single character out of (say) the 62 letters
and digits? I realize that the answer might be "I need more than 62",
but I see you have limited it to 100.

(4) Is there any benefit from packing up several hashes into one call
instead of just calling a simpler hash function several times? The
interface seems very complicated to me.

> For example:
>         ${local_part} = fred@???
>    /var/spool/${formatedhash_3_/;/;/_10;20;30_${local_part}}/Mailbox
> would return 3 hash numbers based on ${local_part} separated by `/'. The
> first hashed number returned would be mapped from 0 to 9, the second from 0
> to 19 and the third from 0 to 29. The returned line would look like:
>    /var/spool/7/17/27/Mailbox


What benefit does this give over

/var/spool/${hash_1_10:$local_part}/${hash_1_20:$local_part}/${hash_1_30:$local_part}/Mailbox

which might return

/var/spool/h/r/B/Mailbox

other than perhaps the quality of the hash function?

Basically, I am worrying about code bloat and specification
complication.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.



--
*** Exim information can be found at http://www.exim.org/ ***