Advertisement
ACheats

Kryptor

Dec 28th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local function convert( chars, dist, inv )
  2. return string.char( ( string.byte( chars ) - 32 + ( inv and -dist or dist ) ) % 95 + 32 )
  3. end
  4.  
  5. local function crypt(str,k,inv)
  6. local enc= "";
  7. for i=1,#str do
  8. if(#str-k[5] >= i or not inv)then
  9. for inc=0,3 do
  10. if(i%4 == inc)then
  11. enc = enc .. convert(string.sub(str,i,i),k[inc+1],inv);
  12. break;
  13. end
  14. end
  15. end
  16. end
  17. if(not inv)then
  18. for i=1,k[5] do
  19. enc = enc .. string.char(math.random(32,126));
  20. end
  21. end
  22. return enc;
  23. end
  24.  
  25. enc1 = {29, 58, 93, 28, 27};
  26. if _ARGS == nil then return "!!crypt + [text] - encrypt\n!!crypt [text] - decrypt" end
  27. if string.find(_ARGS,"+ ") then
  28. local str = string.gsub( _ARGS, "+ ","" )
  29. local crypted = crypt(str,enc1)
  30. return "Encryption: " .. crypted
  31. else
  32. local crypted = _ARGS
  33. return "Decryption: " .. crypt(crypted,enc1,true)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement