Advertisement
Guest User

certificate.lua

a guest
Nov 29th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. return {
  2. encryptCertificate = function(cert)
  3.   local crt={A=50,B=51,C=52,D=53,E=54,F=55,G=56,H=57,I=58,J=59,K=60,L=61,M=62,N=63,O=64,P=65,Q=66,R=67,S=68,T=69,U=70,V=71,W=72,X=73,Y=74,Z=75}
  4.   local final = ""
  5.   for i = 1, cert:len() do
  6.     local k = cert:sub(i,i)
  7.     if not tonumber(k) then
  8.       final = final .. crt[string.upper(cert:sub(i,i))]
  9.     else
  10.       final = final .. "0" .. tostring(k)
  11.     end
  12.   end
  13.   return final
  14. end,
  15. decryptCertificate = function(cert)
  16.   local crt={50="A",51="B",52="C",53="D",54="E",55="F",56="G",57="H",58="I",59="J",60="K",61="L",62="M",63="N",64="O",65="P",66="Q",67="R",68="S",69="T",70="U",71="V",72="W",73="X",74="Y",75="Z"}
  17.   local final = ""
  18.   if cert:len() % 2 > 0 then return final end
  19.   for i = 1, cert:len(), 2 do
  20.     local k = tonumber(i)
  21.     if crt[k] then
  22.         final = final .. tostring(crt[k])
  23.     else
  24.         final = final .. tostring(k:sub(2,2))
  25.     end
  26.   end
  27.   return final
  28. end}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement