note 32634 deleted from function.md5 by didou

From: Date: Tue, 03 Jun 2003 16:50:21 +0000
Subject: note 32634 deleted from function.md5 by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-49632@lists.php.net to get a copy of this message
Note Submitter: hkmaly@matfyz.cz ---- HOWTO use MD5 to crypt (&decrypt) string (Same routine for crypt and decrypt. Same time and password requied.) (hkmaly@matfyz.cz, GPL): function bytexor($a,$b,$l) { $c=""; for($i=0;$i<$l;$i++) { $c.=$a{$i}^$b{$i}; } return($c); } function binmd5($val) { return(pack("H*",md5($val))); } function crypt($msg,$pass,$time) { $key=$pass.$time;$sifra=""; $key1=binmd5($key); while($msg) { $m=substr($msg,0,16); $msg=substr($msg,16); echo "."; $sifra.=bytexor($m,$key1,16); $key1=binmd5($key,$key1,$m); } echo "\n"; return($sifra); }

« previous php.notes (#49632) next »