Skip to content

Бусловский - 3 tasks competed (encrypted, decrypted, bruteforce)#22

Open
Kirill-Buslovskiy wants to merge 10 commits intodemologin:mainfrom
Kirill-Buslovskiy:main
Open

Бусловский - 3 tasks competed (encrypted, decrypted, bruteforce)#22
Kirill-Buslovskiy wants to merge 10 commits intodemologin:mainfrom
Kirill-Buslovskiy:main

Conversation

@Kirill-Buslovskiy
Copy link

No description provided.

@Kirill-Buslovskiy Kirill-Buslovskiy changed the title Бусловский - 3 tasks compited (encrypted, decrypted, bruteforce) Бусловский - 3 tasks competed (encrypted, decrypted, bruteforce) Sep 4, 2025
Copy link
Owner

@demologin demologin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Решено в виде консольного предложения с тремя методами из четырёх возможных, однако практически нет никаких замечаний, поставил оценку B

private final CaesarCipher cipher = new CaesarCipher();
private final BruteForce bruteForce = new BruteForce();

private static final String SOURCE_FILE = "C:/Users/ms/IdeaProjects/CryptoAnalyzerPantera/text/text.txt";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Этот код не будет работать ни на одном компьютере кроме компьютера разработчика. Абсолютные пути никогда нельзя использовать в прикладных программах

private static final String ALPHABET = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя.,\"':-!?";

public String process(String text, int key, boolean encrypt) {
StringBuilder result = new StringBuilder();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

процедура расшифрования и дешифрования производится целиком в памяти, если бы обрабатывал байтовый поток из одного файла в другой файл тогда не было бы никаких ограничений на размер этой памяти

private int evaluateText(String text) {
int score = 0;

if (text.matches(".*[.,]\\s[а-яА-ЯЁё].*")) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот шаблон лучше вынести куда-то в константу и осмысленно её назвать

}
}

System.out.println("Brute Force: Наиболее вероятный ключ: " + bestKey);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

когда вывод находится прямо в методе это всегда плохо потому что заменить такой вывод на мобильный или десктопный будет очень непросто

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants