[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/util/password/ -> PhabricatorIteratedMD5PasswordHasher.php (source)

   1  <?php
   2  
   3  final class PhabricatorIteratedMD5PasswordHasher
   4    extends PhabricatorPasswordHasher {
   5  
   6    public function getHumanReadableName() {
   7      return pht('Iterated MD5');
   8    }
   9  
  10    public function getHashName() {
  11      return 'md5';
  12    }
  13  
  14    public function getHashLength() {
  15      return 32;
  16    }
  17  
  18    public function canHashPasswords() {
  19      return function_exists('md5');
  20    }
  21  
  22    public function getInstallInstructions() {
  23      // This should always be available, but do something useful anyway.
  24      return pht('To use iterated MD5, make the md5() function available.');
  25    }
  26  
  27    public function getStrength() {
  28      return 1.0;
  29    }
  30  
  31    public function getHumanReadableStrength() {
  32      return pht('Okay');
  33    }
  34  
  35    protected function getPasswordHash(PhutilOpaqueEnvelope $envelope) {
  36      $raw_input = $envelope->openEnvelope();
  37  
  38      $hash = $raw_input;
  39      for ($ii = 0; $ii < 1000; $ii++) {
  40        $hash = md5($hash);
  41      }
  42  
  43      return new PhutilOpaqueEnvelope($hash);
  44    }
  45  
  46  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1