Kali ini saya akan membuat chipertext dari php
Jangan lupa menginstall xampp dahulu kalau belum ada
download ke sini
trus untuk software kodingnya menggunakan terserah kalian. disini saya menggunakan sublime
ini hasil nya
untuk kodingnnya seperti ini
ini indexnya
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<?phpinclude "convert.php";?><style>body {font-family:verdana;}table {font-family: verdana;border: 10px solid skyblue;}td,th{font-family: verdana;border:2px solid powderblue;padding:3px;}tr {background-color: skyblue}}</style><head><title>cipher | daniel ken</title><style type="text/css">a:link {color: #000000; text-decoration: none}a:visited {color: #000000; text-decoration: none}a:hover {color: #FF0000; text-decoration: underline}</style><script type="text/javascript">function SelectAll(id){document.getElementById(id).focus();document.getElementById(id).select();}function Info(){alert("source code: Google"+'\n\n'+"thanks to google");}function InfoCaesar(){alert("Key hanya berupa kombinasi angka,"+'\n'+"dan plan text tidak boleh mengandung angka!");}function InfoVigenere(){alert("Key hanya berupa kombinasi kata, tidak boleh mengandung angka,"+'\n'+"dan plan text tidak boleh mengandung angka!");}</script></head><body bg background="mwam.jpg"><center><h2>Cipher Caesar dan Vigenere</h2><h4><a onclick="Info()">M.Fahrur Rozi (1514321019)</a></h4></center><table width="600" align="center"><tr><td width="50%" valign="top"><fieldset><legend><b>Caesar</b></legend><form action="" method="post"><input type="password" name="key_caesar" id="key_caesar" placeholder="key" value="" onclick="SelectAll('key_caesar')" /><input type="submit" value="?" onclick="InfoCaesar()" /><br/><textarea rows="4" name="plantext_caesar" placeholder="plaintext" id="plantext_caesar" cols="33" onclick="SelectAll('plantext_caesar')" ></textarea><br/><input type="submit" name="encrypt_caesar" value="Encrypt" /><input type="submit" name="decrypt_caesar" value="Decrypt" /><input type="reset" value="Reset" /></form></fieldset></td><td valign="top" colspan="3"><fieldset><legend><b>Result</b></legend><?php//----------------------------------------------------------------//// caesar ////----------------------------------------------------------------//if((isset($_POST['key_caesar'])) && (isset($_POST['plantext_caesar'])) && isset($_POST['encrypt_caesar'])){$key=$_POST['key_caesar'];$plantext=$_POST['plantext_caesar'];$split_key=str_split($key);$i=0;$split_chr=str_split($plantext);while ($key>52){$key=$key-52;}foreach($split_chr as $chr){if (char_to_dec($chr)!=null){$split_nmbr[$i]=char_to_dec($chr);} else {$split_nmbr[$i]=$chr;}$i++;}echo '<textarea rows="4" id="result" cols="33" onclick="SelectAll(\'result\')" >';foreach($split_nmbr as $nmbr){if (($nmbr+$key)>52){if (dec_to_char($nmbr)!=null){echo dec_to_char(($nmbr+$key)-52);} else {echo $nmbr;}} else {if (dec_to_char($nmbr)!=null){echo dec_to_char($nmbr+$key);} else {echo $nmbr;}}}echo '</textarea><br/>';} else if ((isset($_POST['key_caesar'])) && (isset($_POST['plantext_caesar'])) && isset($_POST['decrypt_caesar'])){$key=$_POST['key_caesar'];$plantext=$_POST['plantext_caesar'];$i=0;$split_chr=str_split($plantext);while ($key>52){$key=$key-52;}foreach($split_chr as $chr){if (char_to_dec($chr)!=null){$split_nmbr[$i]=char_to_dec($chr);} else {$split_nmbr[$i]=$chr;}$i++;}echo '<textarea rows="4" id="result" cols="33" onclick="SelectAll(\'result\')" >';foreach($split_nmbr as $nmbr){if (($nmbr-$key)<1){if (dec_to_char($nmbr)!=null){echo dec_to_char(($nmbr-$key)+52);} else {echo $nmbr;}} else {if (dec_to_char($nmbr)!=null){echo dec_to_char($nmbr-$key);} else {echo $nmbr;}}}echo '</textarea><br/>';//----------------------------------------------------------------//// vigenere ////----------------------------------------------------------------//} else if ((isset($_POST['key_vigenere'])) && (isset($_POST['plantext_vigenere'])) && (isset($_POST['encrypt_vigenere']))){$key=$_POST['key_vigenere'];$plantext=$_POST['plantext_vigenere'];$len_key=strlen($key);$len_plantext=strlen($plantext);$split_key=str_split($key);$split_plantext=str_split($plantext);echo '<textarea rows="4" id="result" cols="33" onclick="SelectAll(\'result\')" >';$i=0;for($j=0;$j<$len_plantext;$j++){if ($i==$len_key){$i=0;}$split_key2[$j]=$split_key[$i];$i++;}for($k=0;$k<$len_plantext;$k++){$a=char_to_dec($split_key2[$k]);$b=char_to_dec($split_plantext[$k]);if (($a && $b)!=null){echo (tabel_vigenere_encrypt($a, $b));} else {echo $split_plantext[$k];}}echo '</textarea><br/>';} else if ((isset($_POST['key_vigenere'])) && (isset($_POST['plantext_vigenere'])) && (isset($_POST['decrypt_vigenere']))){$key=$_POST['key_vigenere'];$plantext=$_POST['plantext_vigenere'];$len_key=strlen($key);$len_plantext=strlen($plantext);$split_key=str_split($key);$split_plantext=str_split($plantext);echo '<textarea rows="4" id="result" cols="33" onclick="SelectAll(\'result\')" >';$i=0;for($j=0;$j<$len_plantext;$j++){if ($i==$len_key){$i=0;}$split_key2[$j]=$split_key[$i];$i++;}for($k=0;$k<$len_plantext;$k++){$a=char_to_dec($split_key2[$k]);$b=char_to_dec($split_plantext[$k]);if (($a && $b)!=null){echo (tabel_vigenere_decrypt($b, $a));} else {echo $split_plantext[$k];}}echo '</textarea><br/>';} else {echo "result here...";}?></fieldset></td></tr><tr><td valign="top"><fieldset><legend><b>Vigenere</b></legend><form action="" method="post"><input type="text" name="key_vigenere" id="key_vigenere" placeholder="key" value="" onclick="SelectAll('key_vigenere')" /><input type="submit" value="?" onclick="InfoVigenere()" /><br/><textarea rows="4" name="plantext_vigenere" placeholder="plantext" id="plantext_vigenere" cols="33" onclick="SelectAll('plantext_vigenere')" ></textarea><br/><input type="submit" name="encrypt_vigenere" value="Encrypt" /><input type="submit" name="decrypt_vigenere" value="Decrypt" /><input type="reset" value="Reset" /></form></fieldset></td></tr></table></body></html>
lebih lengkapnya lagi download saja disini
terima kasih :)
Tidak ada komentar:
Posting Komentar