contributions/usermanagement/behaviour/commands/users/hashes/pas2p.hash.php
Go to the documentation of this file.00001 <?php 00002 require_once Load::get_module_dir('usermanagement') . '3rdparty/phppass-0.2/PasswordHash.php'; 00003 00004 /** 00005 * Calculates a hash using PHPPass 0.2 in portable mode 00006 * 00007 * @since 0.5.1 00008 * 00009 * @author Gerd Riesselmann 00010 * @ingroup Usermanagement 00011 */ 00012 class Pas2pHash implements IHashAlgorithm { 00013 /** 00014 * Return preconfigured instance of PasswordHash 00015 * 00016 * @return PasswordHash02 00017 */ 00018 protected function create_pass2_instance() { 00019 return new PasswordHash02(8, TRUE); 00020 } 00021 00022 public function hash($source) { 00023 $o_hash = $this->create_pass2_instance(); 00024 return $o_hash->HashPassword($source); 00025 } 00026 00027 public function check($source, $hash) { 00028 $o_hash = $this->create_pass2_instance(); 00029 return $o_hash->CheckPassword($source, $hash); 00030 } 00031 }