Skip to content

Instantly share code, notes, and snippets.

@kostikovmu
Last active April 1, 2022 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kostikovmu/4ad9bd78abf8ec84b11f28b0d0d92340 to your computer and use it in GitHub Desktop.
Save kostikovmu/4ad9bd78abf8ec84b11f28b0d0d92340 to your computer and use it in GitHub Desktop.
ROT13 cipher ( ROT13 шифр )
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