using openssl_random_pseudo_bytes() for state generation with option to inject the hash in the factory