Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package unsch.efpis.metodo;
- import unsch.efpis.cifrador.CifradorCesar;
- import unsch.efpis.cifrador.DescifradorCesar;
- /**
- *
- * @author sin_querer@hotmail.com
- */
- public class CodigoCesar {
- CifradorCesar cifradorCesar = new CifradorCesar();
- DescifradorCesar descifradorCesar = new DescifradorCesar();
- public String encriptarTextoClaro(String textoClaro) {
- String textoCifrado = "";
- for(int i=0; i<textoClaro.length(); i++){
- if(textoClaro.charAt(i) != ' ')
- textoCifrado += cifradorCesar.getTextoCifrado(textoClaro.charAt(i))+"";
- else
- textoCifrado += " ";
- }
- return textoCifrado;
- }
- public String desencriptarTextoCifrado(String textoCifrado) {
- String textoClaro = "";
- for(int i=0; i<textoCifrado.length(); i++){
- if(textoCifrado.charAt(i) != ' ')
- textoClaro += descifradorCesar.getTextoClaro(textoCifrado.charAt(i))+"";
- else
- textoClaro += " ";
- }
- return textoClaro;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement