<?php
	if (!extension_loaded('infosec'))
	{
		if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
  		{
			dl('php_infosec.dll');
		}
   		else
		{
			dl('infosec.so');
		}
 	}
	else
	{
		echo "loaded infosec module success <br/>";
	}

	if(isset($_POST["gendes"]))
	{
		$seed=$_POST["seed"];
		if(strlen($seed) <= 0)
		{
			echo "WARNING : no input seed<br/>";
			exit();
		}
		$keylen=$_POST["keylen"];
		if(strlen($keylen) <= 0)
		{
			echo "WARNING : no input keylwn<br/>";
			exit();
		}

		$des = genDESKey($keylen,$seed);
		#echo base64enc($des),"<br/>";
		echo "DES key : ",current(base64enc(current($des))),"<br/>";
		echo "DES key len: ",next($des),"<br/>";
	}
	exit();
?>

