Beispiel #1
0
 /**
  * @return Hash
  */
 public function getHash() : Hash
 {
     $hash = new Hash();
     $hash->setAlgorithm($this->getAlgorithm());
     $hash->setValue(hash_final(hash_copy($this->getHandle()), true));
     return $hash;
 }
Beispiel #2
0
 /**
  * @param string $data
  * @param string $algorithm
  *
  * @return Hash
  */
 public static function digest(string $data, string $algorithm) : Hash
 {
     $hash = new Hash();
     $hash->setAlgorithm($algorithm);
     $hash->setValue(openssl_digest($data, $algorithm, TRUE));
     return $hash;
 }