Blame | Letzte Änderung | Log anzeigen | RSS feed
<?php// Verschlüsselungsalgorithmusfunction pre($_x){print( "<pre>" );print_r($_x);print( "</pre>" );}/*$_a = array(0 => "2",1 => "4",2 => "8",3 => "16",4 => "32",5 => "64",6 => "128",7 => "256",8 => "512",9 => "1024",10 => "2048",11 => "4096",12 => "8192",13 => "16384");$a = "01012005120053";$a = preg_split('//', $a, -1, PREG_SPLIT_NO_EMPTY);function _crypt($_o, $_a){foreach(array_keys($_o) AS $elem){$_n[]=dechex(ord($_o[$elem])*$_a[$elem]);echo $_n[$elem].".";}// return($_n);}function _ncrypt($_n, $_a){foreach(array_keys($_n) AS $elem){$_o[]=chr(hexdec($_n[$elem])/($_a[$elem]));}return($_o);}$n = _crypt($a,$_a);pre($n);pre(_ncrypt($n,$_a));*/// test$a[]="01012005120053";$a[]="100.00";$a[]="markus@niewerth.com";foreach(array_keys($a) AS $elem){$b[$elem] = sprintf("%u",crc32(md5($a[$elem])));$b[$elem] = wordwrap( $b[$elem] , 2 , "###", 1);$a_[$elem] = explode("###",$b[$elem]);}foreach(array_keys($a_) as $elem){foreach(array_keys($a_[$elem]) as $key){$x[]=dechex($a_[$elem][$key]);}}$key="";for($i=0;$i<count($x);$i++){$key .= strtoupper($x[$i]).( ($i%5==0 && $i!=0) ? "-" : "");}pre($key);?><form name="form1" method="post" action=""><input name="code" type="text" id="code"><input type="submit" name="submit" value="Abschicken"></form><?if($_POST['submit']){// Ncode$ncode="";$code = str_replace("-", "", $_POST['code']);$code = wordwrap( $code , 2 , "###", 1);$code = explode("###",$code);foreach(array_keys($code) AS $elem){$ncode.=hexdec($code[$elem]);}$ncode = wordwrap( $ncode , 10 , "-", 1);$ncode = explode( "-", $ncode );$ncode = $ncode[0]."-".$ncode[1]."-".$ncode[2];// Vcodeforeach(array_keys($a) AS $elem){$b[$elem] = sprintf("%u",crc32(md5($a[$elem])));}$vcode = $b[0]."-".$b[1]."-".$b[2];echo "NCode:$ncode<br>";echo "VCode:$vcode<br>";if($ncode!=$vcode) { echo "Der code war nicht richtig!"; }else{ echo "Dies war ein gülltiger code"; }}?>