SuperRavenSn1per

Encryption Test

Apr 8th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. function encrypt(txt, key)
  2.   enc = ""
  3.   len = string.len(txt, key)
  4.  
  5.   for i = 1,len do
  6.     char = string.sub(txt, i, i)
  7.     byte = string.byte(char)
  8.     byte2 = byte+key
  9.     char2 = string.char(byte2)
  10.     enc = enc..char2
  11.   end
  12. end
  13.  
  14. function decrypt(txt, key)
  15.   dec = ""
  16.   len = string.len(txt)
  17.  
  18.   for i = 1,len do
  19.     char = string.sub(txt, i, i)
  20.     byte = string.byte(char)
  21.     byte2 = byte-key
  22.     char2 = string.char(byte2)
  23.     dec = dec..char2
  24.   end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment