Grover's search on cryptographic hash functions - how can we build the oracle? [duplicate]

Let's say I'd like to search a database and I have a function $f$ such that $f(x) = 0$ for all incorrect entries and $f(x) = 1$ for all target entries.
The crux of Grover's search seems to be that there exists a way to construct a quantum operator $\hat{f}$ in a way that it takes a superposition of states as input and adds a phase only to the target elements from the superposition.