Advertisement
Akuukis

Decrypt Agent code LARP NewAge

Sep 15th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. local key = {
  2.   {"A","B","C","D","E"},
  3.   {"F","G","H","I","K"},
  4.   {"L","M","N","O","P"},
  5.   {"Q","R","S","T","U"},
  6.   {"V","W","X","Y","Z"},
  7. }
  8. local input = assert(io.open("crypted.txt", "r"), "Failed to open input 'crypted.txt' file")
  9. local symbol, ch, text = true, nil, ""
  10. while symbol do
  11.   symbol = input:read(1)
  12.   if tonumber(symbol) then
  13.     if ch then
  14.       text = text .. key[ch][tonumber(symbol)]
  15.       ch = nil
  16.     else
  17.       ch = tonumber(symbol)
  18.     end
  19.   elseif symbol == string.char(32) then
  20.     text = text .. " "
  21.     ch = nil
  22.   elseif symbol == string.char(10) or symbol == string.char(12) then
  23.     text = text .. string.char(10)
  24.     ch = nil
  25.   end
  26. end
  27. print(text)
  28. input:close()
  29. local output = assert(io.open("result.txt", "w"), "Failed to open output file")
  30. output:write(text)
  31. output:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement