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;
}