public static function getNonce($length = 32)
    {
        do {
            $entropy = openssl_random_pseudo_bytes($length, $strong);
        } while ($strong === false);

        $nonce = sha1($entropy);

        return $nonce;
    }