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