Last active
April 1, 2022 10:16
-
-
Save kostikovmu/4ad9bd78abf8ec84b11f28b0d0d92340 to your computer and use it in GitHub Desktop.
ROT13 cipher ( ROT13 шифр )
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
function rot13Decode(str) { | |
return [...str].map( el => { | |
const code = el.charCodeAt(0) | |
const newCode = code > 77 && code < 91 ? + code - 13 : | |
code > 64 && code < 78 ? code + 13 : code | |
return String.fromCharCode(newCode) | |
}).join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment