Created
May 24, 2021 04:58
-
-
Save thecodemedia/04373426608b0f108588bbcf36d77d3c 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
// шифруем сообщение | |
output = ""; | |
for (i = 0; i < input.length; i++) { | |
// берём цифровое значение очередного символа в сообщении и ключе | |
inp = input.charCodeAt(i); | |
k = key.charCodeAt(i); | |
// и применяем к ним исключающее или — XOR | |
output += String.fromCharCode(inp ^ k); | |
} | |
// выводим результат шифрования | |
console.log("Результат работы алгоритма ↓"); | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment