Esempio n. 1
0
 public function buildHash()
 {
     $idBase36 = base36_encode($this->json["id"]);
     $hash = "{$idBase36}";
     foreach ($this->trees as $tree) {
         $hash .= $tree->buildHash();
     }
     return $hash;
 }
Esempio n. 2
0
 public function buildHash()
 {
     $hash = "";
     if ($this->getTotalPointsSpent() === 0) {
         return $hash;
     }
     $hash .= $this->treeHashToken . base36_encode($this->json["id"]);
     $aaHash = collateAdjacentDuplicates(array_map(array($this, "createAAHash"), $this->json["aa"]));
     if (strpos(end($aaHash), "0")) {
         $aaHash . pop();
     }
     foreach ($aaHash as &$value) {
         $repeatedChar = $value[0];
         $numRepeats = strlen($value);
         if ($numRepeats >= 3) {
             $value = $repeatedChar . $this->repeatHashToken . base36_encode($numRepeats);
         }
     }
     $hash .= implode($aaHash);
     return $hash;
 }