hashAlgorithm = $hashAlgorithm; $this->direction = $direction; $this->siblingHash = $siblingHash; $this->level = $level; } /** * Computes the output of this hash entry with given bytes. * * @param array $bytes bytes to compute output for * @return array the result */ public function computeOutput(array $bytes) { $hash = new GTDataHash($this->hashAlgorithm); $hash->update($bytes); $hash->close(); $imprint1 = $hash->getDataImprint(); $imprint2 = $this->siblingHash->getDataImprint(); $output = array(); if ($this->direction == 0) { foreach ($imprint2 as $byte) { array_push($output, $byte); } foreach ($imprint1 as $byte) { array_push($output, $byte); } } else { foreach ($imprint1 as $byte) { array_push($output, $byte); } foreach ($imprint2 as $byte) { array_push($output, $byte); } } array_push($output, $this->level); return $output; } /** * Gets the direction of this hash entry. * * @return int direction of this hash entry */ public function getDirection() { return $this->direction; } /** * Gets the level of this hash entry. * * @return int level of this hash entry */ public function getLevel() { return $this->level; } } ?>