@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final 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}