Skip to content

Instantly share code, notes, and snippets.

@davidsharp
Created February 19, 2022 17:10
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 davidsharp/77ff8bda7a07c488e1027da3987b9cb6 to your computer and use it in GitHub Desktop.
Save davidsharp/77ff8bda7a07c488e1027da3987b9cb6 to your computer and use it in GitHub Desktop.
Dirty little ROT13 function
const rot13 = str => str.replace(/[a-z]/gi,x=>{
const c=x.charCodeAt(0)
const a=c>=97?97:65
return String.fromCharCode(
a+((c-a+13)%26)
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment