Exemple #1
0
        public string CifradoTipoCesar(string texto, int desplazamiento)
        {
            textoPlano = new TextoPlano(texto);
            string textoCifrado = "";
            int    posicion     = 0;

            for (int i = 0; i < textoPlano.textoPlano.Length; i++)
            {
                if (alfabeto.perteneceAlfabeto(textoPlano.textoPlano[i]))
                {
                    posicion = alfabeto.buscarPosicionLetra(textoPlano.textoPlano[i]);
                    posicion = posicion + desplazamiento;

                    if (posicion > alfabeto.caracteres.Length)
                    {
                        posicion = posicion - alfabeto.caracteres.Length;
                    }

                    textoCifrado = textoCifrado + alfabeto.caracteres[posicion];
                }
                else
                {
                    textoCifrado = textoCifrado + textoPlano.textoPlano[i];
                }
            }

            return(textoCifrado);
        }
        static void Main(string[] args)
        {
            string texto = "Vinicius";

            ITexto textoPlano = new TextoPlano(texto);

            ITexto negrito = new Negrito(textoPlano);

            ITexto negritoItalico = new Negrito(new Italico(textoPlano));

            ITexto sublinhadoNegrito = new Sublinhado(negrito);

            Console.WriteLine(textoPlano.Exibir());
            Console.WriteLine(negrito.Exibir());
            Console.WriteLine(negritoItalico.Exibir());
            Console.WriteLine(sublinhadoNegrito.Exibir());

            Console.ReadKey();
        }
Exemple #3
0
 public string cifradoTipoTransposicionInversaPorGrupos(string texto, int desplazamiento)
 {
     textoPlano = new TextoPlano(texto);
     return(textoPlano.invertirTextoGrupos(desplazamiento));
 }
Exemple #4
0
 public string cifradoTipoTransposicionInversa(string texto)
 {
     textoPlano = new TextoPlano(texto);
     return(textoPlano.invertirTexto());
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     textoPlano = new TextoPlano("");
 }
 public Cifrado(TextoPlano textoPlano)
 {
     this.textoPlano = textoPlano;
 }