protected function generateNonce()
    {
        // generate a random string
        $bits   = 256;
        $bytes  = ceil($bits / 8);
        $string = '';
        for ($i = 0; $i < $bytes; $i++) {
            $string .= chr(mt_rand(0, 255));
        }

        // sha1 hash
        return hash('sha1', $string);
    }
protected function generateNonce()
    {
        // generate a random string
        $bits   = 256;
        $bytes  = ceil($bits / 8);
        $string = '';
        for ($i = 0; $i < $bytes; $i++) {
            $string .= chr(mt_rand(0, 255));
        }

        // sha1 hash
        return hash('sha1', $string);
    }
protected function generateNonce ( ) { // generate a random string $ bits = 256 ; $ bytes = ceil ( $ bits / 8 ) ; $ string = '' ; for ( $ i = 0 ; $ i < $ bytes ; $ i ++ ) { $ string .= chr ( mt_rand ( 0 , 255 ) ) ; } // sha1 hash return hash ( 'sha1' , $ string ) ; }
Get a 40 character string to use as a nonce

This is the sha1 of a random string. sha1 gives us 40 characters which is
the length required by Chargify Direct.

@return string
Get a 40 character string to use as a nonce