[code]<?php
//functie die een string omzet in binair.
function str2bin($str) {
	$array = str_split($str,1);
	$bin = '';
	foreach($array as $chr) {
		$bin.=decbin_fix(ord($chr));
	}
	return $bin;
}

//functie die een binaire string omzet in een string.
function bin2str($bin) {
	$array = str_split($bin,8);
	$str = '';
	foreach($array as $chr) {
		$str.=chr(bindec($chr));
	}
	return $str;
}

//functie die een getal omzet in een binair getal en deze links aanvult met het opgegeven aantal 0-en.
function decbin_fix($int,$length = 8) {
	return str_pad(decbin($int),$length,'0',STR_PAD_LEFT);
}

function livc_hex2bin($hex) {
	$hex = str_split($hex,1);
	$bin = '';
	foreach($hex as $h) {
		$bin.=str_pad(base_convert($h,16,2),4,'0',STR_PAD_LEFT);
	}
	return $bin;
}

function bin_encrypt($bin,$password) {
	if($password == '') {
		return $bin;
	}
	$password = livc_hex2bin(md5($password));
	$bin = str_split($bin,1);
	$password = str_split($password,1);
	$pcp = 0;//password cursor position
	$bcp = 0;//binairy cursor position
	while($bcp<count($bin)) {
		if($pcp<count($password)) {
			$pcp ++;
		} else {
			$pcp = 0;
		}
		if($password[$pcp]=='1' && $bin[$bcp]=='0') {
			$bin[$bcp] = '1';
		} elseif($password[$pcp]=='1' && $bin[$bcp]=='1') {
			$bin[$bcp] = '0';
		}
		$bcp ++;
	}
	$bin = array_reduce($bin,'merge');
	return $bin;
}

function merge($a,$b) {
	return $a.$b;
}

function str_encrypt($str,$password) {
	return bin2str(bin_encrypt(str2bin($str),$password));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Zelf Extracting Installer</title>
<style type="text/css">
textarea {
	width:400px;
	height:200px;
	font-size:16px;
}
input {
	width:200px;
}
* {
	margin:0px;
}
</style>
</head>
<body>
<center>

	<form method="post">
		<h2>Input:</h2>
		<textarea name="input"><?php echo stripslashes($_POST['input']);?></textarea>
		<h2>Password:</h2>
		<input type="text" name="password" value="<?php echo stripslashes($_POST['password']);?>"/>
		<br/>
		<input type="submit" style="width:400px;height:40px;font-size:20px;" value="APPLY ENCRYPTION OR DECRYPTION"/>
	</form>
	<?php if(isSet($_POST['input'])) { ?>
	<h2>Output:</h2>
	<h3 style="color:red;">Warning: output may contain characters that can NOT be copy-pasted.</h3>
	<h3 style="color:red;">"Output reversion" is used to check if the output is correct.</h3>
	<h3>If you want copy-paste-able outputs, you should convert the output to HEX or BIN.</h3>
	<h3>Use livc_bin2hex(str2bin($string)) to convert a string to HEX.</h3>
	<h3>Use bin2str(livc_hex2bin($string)); to convert it back to a STRING.</h3>
	<textarea><?php echo str_encrypt(stripslashes($_POST['input']),stripslashes($_POST['password']));?></textarea>
	
	<h2>Output reversed:</h2>
	<h3>to check if encryption is succes</h3>
	<textarea><?php echo str_encrypt(str_encrypt(stripslashes($_POST['input']),stripslashes($_POST['password'])),stripslashes($_POST['password']));?></textarea>
	
	<h2>Decryption of Encrypted string: <?php if(str_encrypt(str_encrypt(stripslashes($_POST['input']),stripslashes($_POST['password'])),stripslashes($_POST['password']))===stripslashes($_POST['input'])){echo '<span style="color:green;">SUCCES</span>';}else {echo '<span style="color:red;">FAIL</span>';}?></h2>
	<?php } ?>

</center>
</body>
</html>[/code]