Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- basic XOR cipher for gLua
- by Haffy
- The purpose of this is just to serve as an example for people wanting to encrypt data
- using a basic method of encryption known as the XOR cipher (https://en.wikipedia.org/wiki/XOR_cipher)
- ]]
- -- this is the key we're going XOR each character with
- local key = 0xA;
- local function CipherString(str)
- local new_str = "";
- for i = 1, string.len(str) do
- new_str = new_str .. string.char(bit.bxor(key, string.byte(str[i])));
- end
- return new_str;
- end
- print(CipherString("hello world!));
Add Comment
Please, Sign In to add comment