[READ-ONLY] Mirror of https://github.com/thoda-dev/DualUniverse. DualUniverse scripts
0

Configure Feed

Select the types of activity you want to include in your feed.

Xor Encrypt

Thomas (Aug 2, 2023, 5:11 PM +0200) b777ec76 f861faf3

+55
+49
CryptString/CryptString.lua
··· 1 + --[[ 2 + String XOR Encryption By Jericho 3 + Version: 1.0.0 4 + Source available at: https://github.com/Jericho1060/DualUniverse/blob/master/CryptString/CryptString.lua 5 + ]] 6 + 7 + CryptString = { 8 + __index = { 9 + keyToDataLen = function (self, key, len) 10 + if #key >= len then 11 + return key:sub(1, len) 12 + end 13 + local result = "" 14 + for i = 1, math.floor(len / #key) do 15 + result = result .. key 16 + end 17 + local leftLen = len % #key 18 + if leftLen > 0 then 19 + result = result .. key:sub(1, leftLen) 20 + end 21 + return result 22 + end, 23 + xor = function (self, num1, num2) 24 + local tmp1 = num1 25 + local tmp2 = num2 26 + local str = "" 27 + while tmp1 > 0 or tmp2 > 0 do 28 + local digit1 = tmp1 % 2 29 + local digit2 = tmp2 % 2 30 + if digit1 == digit2 then 31 + str = "0" .. str 32 + else 33 + str = "1" .. str 34 + end 35 + tmp1 = math.floor(tmp1 / 2) 36 + tmp2 = math.floor(tmp2 / 2) 37 + end 38 + return tonumber(str, 2) 39 + end, 40 + crypt = function(self, data, key) 41 + key = self:keyToDataLen(key, #data) 42 + local result = '' 43 + for i = 1, #data do 44 + result = result .. string.char(self:xor(data:sub(i, i):byte(), key:sub(i, i):byte())) 45 + end 46 + return result 47 + end 48 + } 49 + }
+6
CryptString/CryptString.min.lua
··· 1 + --[[ 2 + String XOR Encryption By Jericho 3 + Version: 1.0.0 4 + Source available at: https://github.com/Jericho1060/DualUniverse/blob/master/CryptString/CryptString.lua 5 + ]] 6 + CryptString={__index={keyToDataLen=function(self,a,b)if#a>=b then return a:sub(1,b)end;local c=""for d=1,math.floor(b/#a)do c=c..a end;local e=b%#a;if e>0 then c=c..a:sub(1,e)end;return c end,xor=function(self,f,g)local h=f;local i=g;local j=""while h>0 or i>0 do local k=h%2;local l=i%2;if k==l then j="0"..j else j="1"..j end;h=math.floor(h/2)i=math.floor(i/2)end;return tonumber(j,2)end,crypt=function(self,m,a)a=self:keyToDataLen(a,#m)local c=''for d=1,#m do c=c..string.char(self:xor(m:sub(d,d):byte(),a:sub(d,d):byte()))end;return c end}}