title: What type of phash Algorithm is this?
body: <p>As i read about phash, there are four types:</p>
  
  <ol>
  <li>A discrete Cosine transform (DCT) based</li>
  <li>A Marr-Hildreth operator based</li>
  <li>A radial variance based and</li>
  <li>A block mean value based image hash function.</li>
  </ol>
  
  <p>in the below code you can see that, there is no DCT section. just simply generating the mean code and hash value. i am sure that, it may be Block mean value based hash function. but in that block-mean value, the algo doesn't has any secret keys.</p>
  
  <pre><code>    &lt;?php
  
      $filename = 'image.jpg';
  
      list($width, $height) = getimagesize($filename);
  
  
      $img = imagecreatefromjpeg($filename);
  
      $new_img = imagecreatetruecolor(8, 8);
  
  
      imagecopyresampled($new_img, $img, 0, 0, 0, 0, 8, 8, $width, $height);
  
      imagefilter($new_img, IMG_FILTER_GRAYSCALE);
  
  
      $colors = array();
      $sum = 0;
  
  
      for ($i = 0; $i &lt; 8; $i++) {
  
          for ($j = 0; $j &lt; 8; $j++) {
  
              $color = imagecolorat($new_img, $i, $j) &amp; 0xff;
  
              $sum += $color;
              $colors[] = $color;
  
          }
      }
  
      $avg = $sum / 64;
  
  
      $hash = '';
      $curr = '';
  
      $count = 0;
      foreach ($colors as $color) {
  
          if ($color &gt; $avg) {
  
              $curr .= '1';
          } else {
  
              $curr .= '0';
          }
  
          $count++;
  
          if (!($count % 4)) {
  
              $hash .= dechex(bindec($curr));
  
              $curr = '';
          }
  
      }
  
      print $hash . "\n";
  ?&gt;
  </code></pre>
  
  <p>what is the type of this algo?</p>