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


class PasswordHashArgon2i extends PasswordBase
{
  
  public static function canIUse() {
    return defined('PASSWORD_ARGON2I') && version_compare(PHP_VERSION, '7.2.0') != -1;
  }

  public static function getHashversion()
  {
    return 2;
  }

  public function getHash($clearTextPW, $options = array(), $salt = "")
  {
    return password_hash($clearTextPW, PASSWORD_ARGON2I, $options);
  }

  public function verifyHash($clearTextPW, $hash)
  {
    return password_verify($clearTextPW, $hash);
  }
}