I am playing around with the following hashing scheme:
- Start with a domain string (same for all users),
- Allow every user to mutate it in any way defining their own custom replacement rules,
- Append the user ID to the result of the above mutation,
- Allow the user to choose their own "work factor" for PBKDF2-HMAC-SHA256, and use the above "salt" to hash their secret.
In the worst case, if the replacement scheme is an identity mapping, and if the user ID is empty, the salt will end up the same and this scheme will suffer from "salt clustering". If the user also did not customize their work factor, this would be a weak scheme allowing for a rainbow table attack for all users for a given domain.
However, let us assume that all three elements have sufficient variability:
- the replacement scheme is arbitrarily complex,
- the user ID exists,
- the work factor is variable
In this case, how does the security of the resulting hash database for a given domain stack up against the pedantic case of choosing a salt using a CSPRNG, and hash the secret using a fixed work factor? Are their any obvious "gotchas"?
Edit: The "setup" is intended to be a one-time cost, to be used across domains, i.e., the replacement scheme will be used for multiple domains.
Edit Redux: From the discussion below, it basically boils down to the fact that as long as the input is deterministic and so is the ruleset - which in most cases will be a naive substitution - a precomputation of rainbow tables for an "intelligent" search space on the salt is possible. I will change my design accordingly.