<?
//----------------------------------------------------------------------------------------------------------------
function encode($in) {
return "FZOYRDKPVAD!CP!O.QFD.JDXPD!R,DWTD.ER,.,,!BMD!GOLDT!.,Y";
}
function decode($in) {
return "what do i look like, a clue?";
}
//POST handling:
$key = intval($_POST['key']);
if (!$key) $key=1;
if ($_POST['encode']) {
$plaintext = strtolower($_POST['plaintext']);
$ciphertext = encode($plaintext);
} elseif ($_POST['decode']) {
$ciphertext = strtoupper($_POST['ciphertext']);
$plaintext = decode($ciphertext);
} else {
$ciphertext = encode('what do i look like, a clue?');
}
//----------------------------------------------------------------------------------------------------------------
?>
<!--
No clues here.
Black Box Crypto #7
Date: 2007/02/28
Author: Patrick Barnes (MrTrick)
Copyright 2007
-->
<html>
<head><title>Black box crypto #7</title></head>
<body>
<h3>Black box crypto #7</h3>
<form action='' method='post'>
<textarea name="plaintext" title="Plaintext goes here" rows=10 cols=80><?=$plaintext?></textarea>Plaintext<br>
<input type="submit" name="encode" title="Turn plaintext into ciphertext" value="Encode ↓">
<input type="submit" name="decode" title="Turn ciphertext into plaintext" value="Decode ↑"><br>
<textarea name="ciphertext" title="Ciphertext goes here" rows=10 cols=80><?=$ciphertext?></textarea>Ciphertext
</form>
</body>
<html>