Skip to content

Instantly share code, notes, and snippets.

View elvenhope's full-sized avatar
📖
Free and Coding again

Davit Zuroshvili elvenhope

📖
Free and Coding again
View GitHub Profile
@elvenhope
elvenhope / XorCipher.lua
Created June 14, 2018 15:21 — forked from obikag/XorCipher.lua
XOR Cipher in Lua. See comments for more information.
cipher = "10101111" -- must be eight digit binary number
--Returns the XOR of two binary numbers
function xor(a,b)
local r = 0
local f = math.floor
for i = 0, 31 do
local x = a / 2 + b / 2
if x ~= f(x) then
r = r + 2^i