Last active
December 26, 2015 21:49
-
-
Save stfbee/7218163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* User: Vlad | |
* Date: 29.10.13 | |
* Time: 20:10 | |
*/ | |
public class rot13 { | |
//Алфавит шифра | |
static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzабвгдежзийклмнопрстуфхцчшщьыъэюяABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЖЗИЙКЛАМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ0123456789.,<>/?!@#$%^&*()_+-=:\"|\\'; {}`~"; | |
//Входящее сообщение | |
static char[] IN = "Сюда надо ввести сообщение".toCharArray(); | |
//Количество символов для прокрутки | |
static final int ROT = 79; | |
public static void main(String[] args) { | |
//Цикл для каждого символа в IN | |
for (int i = 0; i < IN.length; i++) { | |
IN[i] = ALPHABET.charAt((ALPHABET.indexOf(IN[i]) + ROT) % (ROT * 2)); | |
} | |
//Вывод сообщения | |
System.out.println(new String(IN)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment