Advertisement
Guest User

cr

a guest
Nov 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. cle = "chiffrement"
  2. a = "BaseOs est 100% secure!"
  3. --at = {a:byte(1,#a)}
  4. --clet = {cle:byte(1,#cle)}
  5.  
  6. function chiffre(key,text)
  7.   local retour = ""
  8.   local retourT = {}
  9.   local textT = {text:byte(1,#text)}
  10.   local cleT = {cle:byte(1,#cle)}
  11.   local ic = 1
  12.  
  13.   for i=1,#textT do  
  14.     if ic > #cleT-1 then
  15.       ic = 1
  16.     else
  17.       ic = ic+1
  18.     end
  19.    
  20.     retourT[i] = textT[i] + cleT[ic]  
  21.     print(textT[i].."+"..cleT[ic].."="..retourT[i])
  22.     if retourT[i] > 255 then
  23.    
  24.       retourT[i] = retourT[i] - 255
  25.     end
  26.     --print(i.." "..ic)
  27.     retour = retour..string.char(retourT[i])    
  28.   end
  29.  
  30.   return retour  
  31.  
  32. end
  33.  
  34. function dechiffre(cle,text)
  35.   cleT = {cle:byte(1,#cle)}
  36.   textT = {text:byte(1,#text)}
  37.   retourT = {}
  38.   retour = {}
  39.  
  40.   for i=1,#textT do
  41.    
  42.  
  43.   end
  44.  
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement