Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function convert( chars, dist, inv )
- return string.char( ( string.byte( chars ) - 32 + ( inv and -dist or dist ) ) % 95 + 32 )
- end
- local function crypt(str,k,inv)
- local enc= "";
- for i=1,#str do
- if(#str-k[5] >= i or not inv)then
- for inc=0,3 do
- if(i%4 == inc)then
- enc = enc .. convert(string.sub(str,i,i),k[inc+1],inv);
- break;
- end
- end
- end
- end
- if(not inv)then
- for i=1,k[5] do
- enc = enc .. string.char(math.random(32,126));
- end
- end
- return enc;
- end
- enc1 = {29, 58, 93, 28, 27};
- if _ARGS == nil then return "!!crypt + [text] - encrypt\n!!crypt [text] - decrypt" end
- if string.find(_ARGS,"+ ") then
- local str = string.gsub( _ARGS, "+ ","" )
- local crypted = crypt(str,enc1)
- return "Encryption: " .. crypted
- else
- local crypted = _ARGS
- return "Decryption: " .. crypt(crypted,enc1,true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement