Pimcore\Model\Object\ClassDefinition\Data\Password::calculateHash PHP Method

calculateHash() public method

Calculate hash according to configured parameters
public calculateHash ( $data ) : boolean | null | string
$data
return boolean | null | string
    public function calculateHash($data)
    {
        $hash = null;
        if ($this->algorithm === static::HASH_FUNCTION_PASSWORD_HASH) {
            $hash = password_hash($data, PASSWORD_DEFAULT);
        } else {
            if (!empty($this->salt)) {
                if ($this->saltlocation == 'back') {
                    $data = $data . $this->salt;
                } elseif ($this->saltlocation == 'front') {
                    $data = $this->salt . $data;
                }
            }
            $hash = hash($this->algorithm, $data);
        }
        return $hash;
    }