Oracles for Gauss's law on digital quantum computers