Publicado el 22/11/2011 12:11:00 en Criptografía.
Author: d4rkdn4 | Total de votos: 2 Vote
Pensaron que me había olvidado de ddlr? pues, NOOOO! (?) Acá le traigo señor, señora, un regalo perfecto para la familia.. un script en PHP para encriptar usando el cifrado de Vigenère, justo lo que el chico le pidió para estas fiestas. (?)
Fuera de joda, es mi primer script en PHP, no sean malos :C
Un poco de info:
El cifrado Vigenère es un cifrado basado en diferentes series de caracteres o letras del cifrado César formando estos caracteres una tabla, llamada tabla de Vigenère, que se usa como clave. El cifrado de Vigenère es un cifrado polialfabético y de sustitución.
El cifrado Vigenère se ha reinventado muchas veces. El método original fue descrito por Giovan Batista Belaso en su libro de 1553 La cifra del Sig. Giovan Batista Belaso. Sin embargo, fue incorrectamente atribuido más tarde a Blaise de Vigenère, concretamente en el siglo XIX, y por ello aún se le conoce como el "cifrado Vigenère".
Este cifrado es conocido porque es fácil de entender e implementar, además parece irresoluble; esto le hizo valedor del apodo el código indescifrable (le chiffre indéchiffrable, en francés).
En el archivo está el link a wikipedia con el artículo completo, si quieren saber más pueden visitarlo.
<HTML> <TITLE>Cifrado de Vigenère v1.0 by d4rkdn4</TITLE> <HEAD> <style type="text/css"> ::selection{color: #fff;} body {text-aling: center; margin: 0px auto;font-family: tahoma;color: #fff;background-color: #000;margin-top: 20px;} h1 {font-size: 40px;font-family: arial;color: #ff0000;text-align: center;margin: 0px auto;} a {font-size: 10px;color: #fff;text-decoration: none;} a:hover {font-size: 15px; color: #585858; decoration: none;} #databox{text-align: center;margin: 0px auto;margin-top: 20px;} #footer{text-align:center;margin: 0px auto;margin-top: 30px;color: #848484;} #footer b{color: #2EFEF7;} #footer b:hover {color: #fff;} </style> </HEAD> <BODY> <script languaje="javascript"> function acercade () { alert("Debido a la paja del programador, esta versión sólo funciona con mayúsculas y sin espacios. En versiones próximas espero mejorar eso.\nCualquier duda o sugerencia que tengas, o cualquier bug que quieras reportar podés hacerlo a [email protected]\n\t\t\tCoded by: d4rkdn4") } </script> <h1>Cifrado de Vigenère</h1> <center><a href="https://es.wikipedia.org/wiki/Cifrado_de_Vigen%C3%A8re">[+] Info </a>|<a onClick="acercade()" onmouseover="document.body.style.cursor='pointer'"> [+] About</a> | <a href="https://d4rk2script.blogspot.com">[+]Blog</a></center> <div id=databox> <FORM METHOD="GET"> <textarea rows=10 cols=40 name=texto>Texto a encriptar...</textarea><br /> Ingresa la clave de encriptacion: <input type=text size=20 name=clave></input><br /> <Input ACTION="" type=submit value=Encriptar><br/> </FORM> </div> <?php $texto = $_GET ['texto']; $clave = $_GET ['clave']; $l = 0;$textn = array(); // Esto probablemente se pueda acortar, pero así queda sexy $A = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"); $B = array("B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A"); $C = array("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B"); $D = array("D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C"); $E = array("E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D"); $F = array("F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E"); $G = array("G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F"); $H = array("H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G"); $I = array("I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H"); $J = array("J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I"); $K = array("K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J"); $L = array("L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"); $M = array("M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"); $N = array("N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"); $O = array("O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N"); $P = array("P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O"); $Q = array("Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"); $R = array("R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q"); $S = array("S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R"); $T = array("T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S"); $U = array("U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"); $V = array("V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U"); $W = array("W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V"); $X = array("X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W"); $Y = array("Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X"); $Z = array("Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y"); $a = array("A" => 0, "B" => 1, "C" => 2, "D" => 3, "E" => 4, "F" => 5, "G" => 6, "H" => 7, "I" => 8, "J" => 9, "K" => 10, "L" => 11, "M" => 12, "N" => 13, "O" => 14, "P" => 15, "Q" => 16, "R" => 17, "S" => 18, "T" => 19, "U" => 20, "V" => 21, "W" => 22, "X" => 23, "Y" => 24, "Z" => 25,); for ($v=0;$v<strlen($texto);$v++) { $m = $a["$texto[$v]"]; array_push($textn, "$m"); } // Encripteishon while ($l<strlen($texto)) { for ($i=0;$i<strlen($clave);$i++) { $clavee = $$clave[$i]; $resultado = $resultado . $clavee[$textn[$l]]; $l++; } } echo "<div id=databox>"; echo "<textarea rows=10 cols=40 readonly=readonly>$resultado</textarea><br />"; echo "</div>"; ?> <div id=footer>coded by <b>d4rk dn4</b> (c) 2011<br />Under<b>&</b>Above Team</div> </BODY> </HTML>
Una cap:

(había encriptado la palabra ARQUIMEDES con la clave SILLA)
Saludos!