I'd like to create a database of questions and answers so that an attacker with access to the database can't obtain either the questions or the answers.
H1 are secure hashes, looking up the answer to a question might proceed as follows:
lookup(H0(question)) -> value H1(question) XOR value -> answer
Can this be done securely with a hash function such as SHA1?
I've looked at HMAC, which could be used to combine the message with additional strings. The additional strings wouldn't be secret. Would access to one MAC weaken the other?
Btw.: The answer would be the same size as the hash.
To answer a question that was asked -- the application is unique. The database would be publicly accessible, and anyone could store a question, answer pair. The encryption would be done client-side, so the server would never see plaintext. You shouldn't be able to get any useful information from seeing the database itself.