private function truncate($hash)
    {
        $offset = ord($hash[strlen($hash)-1]) & 0xf;
        
        return (
            ((ord($hash[$offset+0]) & 0x7f) << 24 ) |
            ((ord($hash[$offset+1]) & 0xff) << 16 ) |
            ((ord($hash[$offset+2]) & 0xff) << 8 ) |
            (ord($hash[$offset+3]) & 0xff)
            ) % pow(10, $this->digits);
    }
private function truncate($hash)
    {
        $offset = ord($hash[strlen($hash)-1]) & 0xf;
        
        return (
            ((ord($hash[$offset+0]) & 0x7f) << 24 ) |
            ((ord($hash[$offset+1]) & 0xff) << 16 ) |
            ((ord($hash[$offset+2]) & 0xff) << 8 ) |
            (ord($hash[$offset+3]) & 0xff)
            ) % pow(10, $this->digits);
    }
private function truncate ( $ hash ) { $ offset = ord ( $ hash [ strlen ( $ hash ) - 1 ] ) & 0xf ; return ( ( ( ord ( $ hash [ $ offset + 0 ] ) & 0x7f ) << 24 ) | ( ( ord ( $ hash [ $ offset + 1 ] ) & 0xff ) << 16 ) | ( ( ord ( $ hash [ $ offset + 2 ] ) & 0xff ) << 8 ) | ( ord ( $ hash [ $ offset + 3 ] ) & 0xff ) ) % pow ( 10 , $ this -> digits ) ; }
Creates the basic number for otp from hash

This number is left padded with zeros to the required length by the
calling function.

@param string $hash hmac hash
@return number
Creates the basic number for otp from hash