Hash salt John Cowan 24 Jan 2016 06:20 UTC

I've decided to exclude all talk of salt from SRFI 125 and confine
it to SRFI 128, which now contains all the details of hash functions.
As I mentioned, I've added macros for hash-bound and hash-salt to
the new draft, but also something for changing the salt value
dynamically.  Here's the definition:

(with-hash-salt salt hash-function obj) [syntax]

Invokes the procedure hash-function on the object obj in such a way
that any reference to (hash-salt) dynamically within the invocation
will return salt rather than its default value. It is an error unless
the value of salt is less than the value of bound.

There is no obvious safe and portable way to implement this other than as
a SRFI 39 or R7RS-small parameter, although on a Scheme without threads
it can be implemented as a fluid variable whose value is saved locally
before calling the hash function and then restored.


John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
Assent may be registered by a signature, a handshake, or a click of a computer
mouse transmitted across the invisible ether of the Internet. Formality
is not a requisite; any sign, symbol or action, or even willful inaction,
as long as it is unequivocally referable to the promise, may create a contract.
       --Specht v. Netscape