Proposal for passing bound and salt in a safe way John Cowan 16 Oct 2015 16:05 UTC

Here's my current proposal.  Add two procedures `hash-bound` and
`hash-salt` to the SRFI 125 and 126 APIs.  The first returns an upper
bound on the result returned by a hash function; the second returns a
salt value for the hash function to take into account.

It is an error to call either procedure except from a hash function being
invoked by a hash table operation.  However, hash functions are free not
to call these procedures, or to ignore what they return.  Therefore there
is no guarantee that the value returned by the hash function is either
bounded or salted.  The framework guarantees that the procedures will
return meaningful values in all cases.

(Perhaps this means that `hash-bound` should be allowed to return #f if
the framework has nothing to say about bounds.  Alternatively, it can
just return some large fixnum.)

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
'Tis the Linux rebellion / Let coders take their place,
The Linux-nationale / Shall Microsoft outpace,
We can write better programs / Our CPUs won't stall,
So raise the penguin banner of / The Linux-nationale.  --Greg Baker