Page MenuHomePhorge

PhutilHashingIterator.php
No OneTemporary

PhutilHashingIterator.php

<?php
final class PhutilHashingIterator
extends PhutilProxyIterator
implements Iterator {
private $hash;
private $algorithm;
public function setAlgorithm($algorithm) {
$this->algorithm = $algorithm;
return $this;
}
public function getAlgorithm() {
return $this->algorithm;
}
public function getHash() {
$hash = $this->getHashResource();
return hash_final($hash, $raw_output = false);
}
protected function didReadValue($value) {
$hash = $this->getHashResource();
hash_update($hash, $value);
return $value;
}
private function getHashResource() {
if (!$this->hash) {
$algorithm = $this->getAlgorithm();
$this->hash = hash_init($algorithm);
}
return $this->hash;
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Jan 19, 15:27 (3 w, 23 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1114202
Default Alt Text
PhutilHashingIterator.php (757 B)

Event Timeline