f(program,state)=hash. hash is unique for every pair of (program,state). f, program and state are public. Maybe state can be made private.
f^−1(hash) does not exist, and there is no function g, g(hash)=(program,state). Meaning, there is no other way to obtain the hash but by using f.
verify(program,state,hash)=true, if f(program,state)=hash. False otherwise.
Rohit is right.
Another option, you can use HMAC
Wouldn't any cryptographic hash work?
f[program_, state_] := Hash[program <> state, "SHA512", "HexString"];
verify[program_, state_, hash_] := f[program, state] == hash;
hash = f["Hello", "World"]
verify["Hello", "World", hash]
(* True *)