MediaWiki
REL1_24
|
00001 <?php 00002 00003 class LayeredParameterizedPasswordTest extends PasswordTestCase { 00004 protected function getTypeConfigs() { 00005 return array( 00006 'testLargeLayeredTop' => array( 00007 'class' => 'LayeredParameterizedPassword', 00008 'types' => array( 00009 'testLargeLayeredBottom', 00010 'testLargeLayeredBottom', 00011 'testLargeLayeredBottom', 00012 'testLargeLayeredBottom', 00013 'testLargeLayeredFinal', 00014 ), 00015 ), 00016 'testLargeLayeredBottom' => array( 00017 'class' => 'Pbkdf2Password', 00018 'algo' => 'sha512', 00019 'cost' => 1024, 00020 'length' => 512, 00021 ), 00022 'testLargeLayeredFinal' => array( 00023 'class' => 'BcryptPassword', 00024 'cost' => 5, 00025 ) 00026 ); 00027 } 00028 00029 public static function providePasswordTests() { 00031 return array( 00032 array( true, ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC', 'testPassword123' ), 00033 ); 00035 } 00036 00040 public function testLargeLayeredPartialUpdate() { 00042 $partialPassword = $this->passwordFactory->newFromType( 'testLargeLayeredBottom' ); 00043 $partialPassword->crypt( 'testPassword123' ); 00044 00046 $totalPassword = $this->passwordFactory->newFromType( 'testLargeLayeredTop' ); 00047 $totalPassword->partialCrypt( $partialPassword ); 00048 00049 $this->assertTrue( $totalPassword->equals( 'testPassword123' ) ); 00050 } 00051 }