Advertisement
Kodos

Untitled

Jul 2nd, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.35 KB | None | 0 0
  1. function Rotate13(t)
  2.   local byte_a, byte_A = string.byte('a'), string.byte('A')
  3.   return (string.gsub(t, "[%a]",
  4.       function (char)
  5.         local offset = (char < 'a') and byte_A or byte_a
  6.         local b = string.byte(char) - offset -- 0 to 25
  7.         b = math.mod(b  + 13, 26) + offset -- Rotate
  8.         return string.char(b)
  9.       end
  10.     ))
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement