Created
May 24, 2021 04:58
-
-
Save thecodemedia/d7bc86bbce6cd59482956e2cf1d924b0 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
// если длина ключа меньше длины сообщения — говорим пользователю и генерируем свой ключ | |
if ((key.length) < (input.length)) { | |
alert("Ключ короче сообщения, это небезопасно. Скопируйте новый сгенерированный ключ из консоли браузера."); | |
// в самом начале ключ будет пустой | |
key = ""; | |
// генерируем новый ключ такой же длины, как и сообщение | |
for (var i = 0; i < input.length; i++) { | |
key += String.fromCharCode(getRandomInt(0,66535)); | |
} | |
// выводим новый ключ шифрования | |
console.log("Скопируйте новый ключ ↓"); | |
console.log(key); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment