Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

pwd.inc.php

Go to the documentation of this file.
00001 <?php 00002 00003 function pwdEncode($user,$password,$salt = "winniePoe") 00004 { 00005 $newpepper = "a".substr(dechex(crc32($salt.$user)),0,2); 00006 $pswchars = str_split($password); 00007 00008 $newpassword=""; 00009 foreach($pswchars as $ch) 00010 { 00011 $newpassword = dechex(hexdec($newpepper) - ord($ch)*2).$newpassword; 00012 } 00013 00014 return $newpassword; 00015 } 00016 00017 function pwdDecode($user,$password,$salt = "winniePoe") 00018 { 00019 $oldpepper = "a".substr(dechex(crc32($salt.$user)),0,2); 00020 $chars = explode(" ",wordwrap($password,3," ",1)); 00021 00022 $oldpassword = ""; 00023 foreach($chars as $ch) 00024 { 00025 if(!empty($ch)) 00026 $oldpassword = chr((hexdec($oldpepper) - (hexdec($ch)))/2).$oldpassword; 00027 } 00028 00029 return $oldpassword; 00030 } 00031 00032 ?>

Generated on Fri Jun 25 00:00:22 2004 for a(tom)Blog by doxygen 1.3.7