Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package unsch.efpis.cifrador;
- /**
- *
- * @author [email protected]
- */
- public class CifradorCesar {
- char tablaCesar[] = {
- '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'
- };
- public char getTextoCifrado(char parTextoClaro) {
- int indiceX = 0;
- for (int i = 0; i < tablaCesar.length; i++) {
- if (parTextoClaro == tablaCesar[i]) {
- indiceX = i;
- break;
- }
- }
- return tablaCesar[(indiceX + 3) % 27];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment