<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */


class PasswordHashUTF8Argon2I extends PasswordBase
{
  public static function canIUse()
  {
    return defined('PASSWORD_ARGON2I');
  }

  public static function getHashversion()
  {
    return 4;
  }

  public function getHash($clearTextPW, $options = array(), $salt = '')
  {
    return password_hash(\mb_convert_encoding($clearTextPW, UTF_8, \CodingOperations::getInternalEncoding()), PASSWORD_ARGON2I, $options);
  }

  public function verifyHash($clearTextPW, $hash)
  {
    return password_verify(\mb_convert_encoding($clearTextPW, UTF_8, \CodingOperations::getInternalEncoding()), $hash);
  }
}