Skip to content

Instantly share code, notes, and snippets.

@nilium
Forked from rlemon/gist:3297381
Created August 8, 2012 18:53
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 nilium/3297532 to your computer and use it in GitHub Desktop.
Save nilium/3297532 to your computer and use it in GitHub Desktop.
ROT13 in Ruby
['string'].map{|a|a.split('').map{|b|return b if(!/[a-z]/i.match b);c=b[0].ord>=96;k=(b.downcase[0].ord-96+12)%26+1;[k+(c ? 96: 64)].pack 'U*'}.join}.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment