<?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["desenc"]))
	{
		$data=$_POST["plaint"];
		if(strlen($data) <= 0)
		{
			echo "WARNING : no input data<br/>";
			exit();
		}
		$key=$_POST["key"];
                if(strlen($key) <= 0)
                {
                        echo "WARNING : no input key<br/>";
			exit();
                }
		$desenc = desEncrypt($data,$key);
		#echo base64enc($desenc),"<br/>";
		echo "des encryption : ",current(base64enc(current($desenc))),"<br/>";
		echo "des encryption len: ",next($desenc),"<br/>";
	}
	exit();
?>
