ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
APR1_MD5_HashTest.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
7  public function testHash_WhiteHat101() {
8  $this->assertEquals(
9  '$apr1$HIcWIbgX$G9YqNkCVGlFAN63bClpoT/',
10  APR1_MD5::hash('WhiteHat101','HIcWIbgX')
11  );
12  }
13 
14  public function testHash_apache() {
15  $this->assertEquals(
16  '$apr1$rOioh4Wh$bVD3DRwksETubcpEH90ww0',
17  APR1_MD5::hash('apache','rOioh4Wh')
18  );
19  }
20 
21  public function testHash_ChangeMe1() {
22  $this->assertEquals(
23  '$apr1$PVWlTz/5$SNkIVyogockgH65nMLn.W1',
24  APR1_MD5::hash('ChangeMe1','PVWlTz/5')
25  );
26  }
27 
28  // Test some awkward inputs
29 
30  public function testHash_ChangeMe1_blankSalt() {
31  $this->assertEquals(
32  '$apr1$$DbHa0iITto8vNFPlkQsBX1',
33  APR1_MD5::hash('ChangeMe1','')
34  );
35  }
36 
37  public function testHash_ChangeMe1_longSalt() {
38  $this->assertEquals(
39  '$apr1$PVWlTz/5$SNkIVyogockgH65nMLn.W1',
40  APR1_MD5::hash('ChangeMe1','PVWlTz/50123456789')
41  );
42  }
43 
44  public function testHash_ChangeMe1_nullSalt() {
45  $hash = APR1_MD5::hash('ChangeMe1');
46  $this->assertEquals(37, strlen($hash));
47  }
48 
49  public function testHash__nullSalt() {
50  $hash = APR1_MD5::hash('');
51  $this->assertEquals(37, strlen($hash));
52  }
53 
54  // a null password gets coerced into the blank string.
55  // is this sensible?
56  public function testHash_null_nullSalt() {
57  $hash = APR1_MD5::hash(null);
58  $this->assertEquals(37, strlen($hash));
59  }
60 
61 }
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406