It looks like you're new here. If you want to get involved, click one of these buttons!
local function convert(chars,dist,inv) local charInt = string.byte(chars); for i=1,dist do if(inv)then charInt = charInt - 1; else charInt = charInt + 1; end if(charInt<32)then if(inv)then charInt = 126; else charInt = 126; end elseif(charInt>126)then if(inv)then charInt = 32; else charInt = 32; end end end return string.char(charInt); end --Change this key, value from 0 to 255 local zendiosKey = {0,123,123,255,101}; local function crypt(str,inv) local enc= ""; for i=1,#str do if(#str-zendiosKey[5] >= i or not inv)then for inc=0,3 do if(i%4 == inc)then enc = enc .. convert(string.sub(str,i,i),zendiosKey[inc+1],inv); break; end end end end if(not inv)then for i=1,zendiosKey[5] do enc = enc .. string.char(math.random(32,126)); end end return enc; end -- Sample usage: local data_json_sample = "{framework:'Gideros'}"; local encrypt_string = crypt(data_json_sample,false); print (encrypt_string) local decrypt_string = crypt(encrypt_string,true); print (decrypt_string) |
Uploading finished. 8#Ta*"Yo/({'c&Fe/,U':s^>)O5;wT^*NDOkPDaRYE c)[rNfODjTAz[0C,fzZ"?%\,prXdq!,cZ4&0[<a href="https://forum.gideros.rocks/profile/%26gt" rel="nofollow">@></a>;B^llRZku-[F8,q&HV<T5=*l,;jukfZBq5r57S}%' {framework:'Gideros'} |
Likes: TheOddLinguist, mertocan, thanhquan1512, fxone
Comments
Scoreoid for example, use the DES encryption algorithm.
Anyone have an implementation of the algorithm DES for lua?)
Likes: fxone