protected function generateSecureHash($hashIdentifier, $data)
    {
        // mitigate rainbow table attack
        $halfDataLen = strlen($data) / 2;

        $stringToHash = $hashIdentifier
                      . substr($data, 0, $halfDataLen)
                      . $this->getSalt()
                      . substr($data, $halfDataLen)
                      ;

        return $this->hashData($stringToHash);
    }
protected function generateSecureHash($hashIdentifier, $data)
    {
        // mitigate rainbow table attack
        $halfDataLen = strlen($data) / 2;

        $stringToHash = $hashIdentifier
                      . substr($data, 0, $halfDataLen)
                      . $this->getSalt()
                      . substr($data, $halfDataLen)
                      ;

        return $this->hashData($stringToHash);
    }
protected function generateSecureHash ( $ hashIdentifier , $ data ) { // mitigate rainbow table attack $ halfDataLen = strlen ( $ data ) / 2 ; $ stringToHash = $ hashIdentifier . substr ( $ data , 0 , $ halfDataLen ) . $ this -> getSalt ( ) . substr ( $ data , $ halfDataLen ) ; return $ this -> hashData ( $ stringToHash ) ; }
Generates a hash using a hash "identifier" and some data to hash. The hash identifier is
a string that differentiates the hash in some way.

We can't get the identifier back from a hash but we can tell if a hash is the hash for
a specific identifier by computing a hash for the identifier and comparing with the
first hash.

@param string $hashIdentifier A unique string that identifies the hash in some way, can,
for example, be user information or can contain an expiration date,
or whatever.
@param string $data Any data that needs to be hashed securely, ie, a password.
@return string The hash string.
Generates a hash using a hash identifier and some data to hash . The hash identifier is a string that differentiates the hash in some way .