Equality check in homomorphic encryption
Depends on what you mean "returns 1 if there are equal".

If you mean "returns an encrypted 1 if there are equal, and 0 if there are not", then here's one straight-forward way; to compare the values $A$ and $B$, you just compute the encrypted value $1 - (A - B)^{p-1}$; that is an encrypted 1 if $A = B$ (because $A - B = 0$), and an encrypted 0 if $A \ne B$ (Fermat's Little Theorem). This takes $O(\log p)$ homomorphic multiplications, and two homomorphic subtractions.

On the other hand, if you mean "returns the value 1", and so allows someone without the private key whether two values are the same, we hope that's not possible.  That would be a violation of the security of the system; it would allow an adversary to determine the value of encrypted plaintexts, and so if it were possible, the homomorphic system would be insecure.