Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. function encryptString(str,code)
  2. -- character table
  3. chars="1234567890!@#$%^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,<.>/?;:'[{]}\|`~"
  4. -- new code begin
  5. newcode=""
  6. -- we start
  7. for i=1, 999 do
  8. if string.sub(str,i,i) == "" then
  9. break
  10. else
  11. com=string.sub(str,i,i)
  12. end
  13. for x=1, 90 do
  14. cur=string.sub(chars,x,x)
  15. if com == cur then
  16. new=x+code
  17. while new > 90 do
  18. new = new - 90
  19. end
  20. newcode=""..newcode..""..string.sub(chars,new,new)..""
  21. end
  22. end
  23. end
  24. print("you new code is: "..newcode.."")
  25. return newcode
  26. end
  27.  
  28. function unencryptString(str,code)
  29. -- character table
  30. chars="1234567890!@#$%^&*()qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM ,<.>/?;:'[{]}\|`~"
  31. -- new code begin
  32. newcode=""
  33. -- we start
  34. for i=1, 999 do
  35. if string.sub(str,i,i) == "" then
  36. break
  37. else
  38. com=string.sub(str,i,i)
  39. end
  40. for x=1, 90 do
  41. cur=string.sub(chars,x,x)
  42. if com == cur then
  43. new=x-code
  44. while new < 0 do
  45. new = new + 90
  46. end
  47. newcode=""..newcode..""..string.sub(chars,new,new)..""
  48. end
  49. end
  50. end
  51. print("you old string is: "..newcode.."")
  52. return newcode
  53. end
Add Comment
Please, Sign In to add comment