Constrained Pseudorandom Functions and Their Applications