public function generateNonce()
    {
        if (function_exists('openssl_random_pseudo_bytes') === true) {
            $hash = md5(openssl_random_pseudo_bytes(32));
        } else {
            $hash = md5(uniqid(mt_rand()));
        }
        return $hash;
    }