Cryptographic hash with ability to ignore specific bits based on a hidden pattern?
Suppose you had such a hash. Then anyone who knew some value for which the condition matched could find out the full pattern/mask:


You know some environment for which mask(hash( environment ), encryptedPattern ) == encryptedCondition.
You can flip one bit at a time, compute the masked hash, and see if you still get a match. If you do, that bit was masked out in the (unencrypted) mask pattern.


So possibly what you want is impossible. However, if you only need the pattern to remain hidden from those who do not know any matches, it may be possible using homomorphic encryption.


Take a suitable homomorphic encryption system that allows computing ANDs and verifying the results*. Encrypt the mask m = E(pattern) and the condition c = E(requirement).
The user encrypts a value E(environment), ANDs with the mask and compares to the condition: E(environment) &amp; m == c.


* The system must be deterministic and have E(x) &amp; E(y) = E(x&amp;y).

(Note: the use of deterministic encryption means that a user can guess and test values against pattern and requirement. This is quite weak, but conceivably there could be applications.)