Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.93 KB | None | 0 0
  1. --Code to SHA-256 it
  2. local g=string.gsub --sha256=loadstring(g(g(g(g(g(g(g(g('Sa=XbandSb=XbxWSc=XlshiftSd=unpackSe=2^32SYf(g,h)Si=g/2^hSj=i%1Ui-j+j*eVSYk(l,m)Sn=l/2^mUn-n%1VSo={0x6a09e667Tbb67ae85T3c6ef372Ta54ff53aT510e527fT9b05688cT1f83d9abT5be0cd19}Sp={0x428a2f98T71374491Tb5c0fbcfTe9b5dba5T3956c25bT59f111f1T923f82a4Tab1c5ed5Td807aa98T12835b01T243185beT550c7dc3T72be5d74T80deb1feT9bdc06a7Tc19bf174Te49b69c1Tefbe4786T0fc19dc6T240ca1ccT2de92c6fT4a7484aaT5cb0a9dcT76f988daT983e5152Ta831c66dTb00327c8Tbf597fc7Tc6e00bf3Td5a79147T06ca6351T14292967T27b70a85T2e1b2138T4d2c6dfcT53380d13T650a7354T766a0abbT81c2c92eT92722c85Ta2bfe8a1Ta81a664bTc24b8b70Tc76c51a3Td192e819Td6990624Tf40e3585T106aa070T19a4c116T1e376c08T2748774cT34b0bcb5T391c0cb3T4ed8aa4aT5b9cca4fT682e6ff3T748f82eeT78a5636fT84c87814T8cc70208T90befffaTa4506cebTbef9a3f7Tc67178f2}SYq(r,q)if e-1-r[1]<q then r[2]=r[2]+1;r[1]=q-(e-1-r[1])-1 else r[1]=r[1]+qVUrVSYs(t)Su=#t;t[#t+1]=0x80;while#t%64~=56Zt[#t+1]=0VSv=q({0,0},u*8)fWw=2,1,-1Zt[#t+1]=a(k(a(v[w]TFF000000),24)TFF)t[#t+1]=a(k(a(v[w]TFF0000),16)TFF)t[#t+1]=a(k(a(v[w]TFF00),8)TFF)t[#t+1]=a(v[w]TFF)VUtVSYx(y,w)Uc(y[w]W0,24)+c(y[w+1]W0,16)+c(y[w+2]W0,8)+(y[w+3]W0)VSYz(t,w,A)SB={}fWC=1,16ZB[C]=x(t,w+(C-1)*4)VfWC=17,64ZSD=B[C-15]SE=b(b(f(B[C-15],7),f(B[C-15],18)),k(B[C-15],3))SF=b(b(f(B[C-2],17),f(B[C-2],19)),k(B[C-2],10))B[C]=(B[C-16]+E+B[C-7]+F)%eVSG,h,H,I,J,j,K,L=d(A)fWC=1,64ZSM=b(b(f(J,6),f(J,11)),f(J,25))SN=b(a(J,j),a(Xbnot(J),K))SO=(L+M+N+p[C]+B[C])%eSP=b(b(f(G,2),f(G,13)),f(G,22))SQ=b(b(a(G,h),a(G,H)),a(h,H))SR=(P+Q)%e;L,K,j,J,I,H,h,G=K,j,J,(I+O)%e,H,h,G,(O+R)%eVA[1]=(A[1]+G)%e;A[2]=(A[2]+h)%e;A[3]=(A[3]+H)%e;A[4]=(A[4]+I)%e;A[5]=(A[5]+J)%e;A[6]=(A[6]+j)%e;A[7]=(A[7]+K)%e;A[8]=(A[8]+L)%eUAVUY(t)t=t W""t=type(t)=="string"and{t:byte(1,-1)}Wt;t=s(t)SA={d(o)}fWw=1,#t,64ZA=z(t,w,A)VU("%08x"):rep(8):format(d(A))V',"S"," local "),"T",",0x"),"U"," return "),"V"," end "),"W","or "),"X","bit32."),"Y","function "),"Z"," do "))()
  3.  
  4. function clearScreen()
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. end
  8.  
  9. function loggedOn(username, password, balance)
  10. while true do
  11. clearScreen()
  12. print(" The Bank Of Sanctuary")
  13. print("---------------------------------------------------")
  14. print("Acount: "..username.." Balance: "..balance)
  15. print("---------------------------------------------------")
  16. print("1 - Pay another user")
  17. print("2 - Deposit")
  18. print("3 - Withdraw")
  19. print("4 - View spending log")
  20. print("5 - Log Out")
  21. print("")
  22. write("Action> ")
  23. action = read()
  24. if action == "1" then
  25. payScreen(username, password, balance)
  26. elseif action == "2" then
  27.  
  28. elseif action == "3" then
  29.  
  30. elseif action == "4" then
  31.  
  32. elseif action == "5" then
  33. return
  34. end
  35. end
  36. end
  37.  
  38. function viewLog(username, password, balance)
  39. clearScreen()
  40. print(" The Bank Of Sanctuary")
  41. print("---------------------------------------------------")
  42. print("Acount: "..username.." Balance: "..balance)
  43. print("---------------------------------------------------")
  44. return;
  45. end
  46.  
  47. function userExists(username)
  48. modem.transmit(1,1,"balance`"..username.."`password1234")
  49.  
  50. modem.open(1)
  51. local _, side, freq, rfreq, message = os.pullEvent("modem_message")
  52. if message == "404" then
  53. return false
  54. end
  55. return true
  56. end
  57.  
  58. function payScreen(username, password, balance)
  59. clearScreen()
  60. print(" The Bank Of Sanctuary")
  61. print("---------------------------------------------------")
  62. print("Acount: "..username.." Balance: $"..balance)
  63. print("---------------------------------------------------")
  64. write("Username to pay: ")
  65. payee = read()
  66. clearScreen()
  67. print("The Bank Of Sanctuary")
  68. print("---------------------------------------------------")
  69. print("Acount: "..username.." Balance: $"..balance)
  70. print("---------------------------------------------------")
  71. write("Amount to pay: $")
  72. amount = read()
  73. if amount > balance then
  74. clearScreen();
  75. difference = amount - balance;
  76. print("You do not have enough money to pay, you need $"..difference.." more!")
  77. os.sleep(4)
  78. elseif userExists(payee) == false
  79. --Thats not a user!
  80. clearScreen()
  81. print(payee.." is not a valid user!")
  82. os.sleep(4)
  83. else
  84. --Update graphical balance
  85. balance = balance - amount
  86. modem.transmit(1,1,"pay`"..username.."`"..password.."`"..payee.."`"..amount)
  87. end
  88. return;
  89. end
  90.  
  91. while true do
  92. clearScreen()
  93. print("Welcome to The Bank!")
  94. print("Press 1 for a new user")
  95. print("Press 2 for an existing user")
  96. print("")
  97. write("Key> ")
  98.  
  99. key = read()
  100. local modem = peripheral.wrap("back")
  101. if key == "1" then
  102. --user wants to create a new account
  103. clearScreen()
  104. print("Register")
  105. write("Username: ")
  106. username = read()
  107. clearScreen()
  108. print("Register")
  109. write("Password: ")
  110. pssw = read("*")
  111. --Hash password
  112. password = sha256(pssw)
  113. pssw = ""
  114. print("Waiting for server...")
  115. modem.transmit(1,1,"register`"..username.."`"..password)
  116. modem.open(1)
  117. local _, side, freq, rfreq, message = os.pullEvent("modem_message")
  118. if messsage == "409" then
  119. print("This user is already registered!")
  120. else
  121. print("User "..username.." registered!")
  122. end
  123. os.sleep(4)
  124. else
  125. --user just wants to login
  126. clearScreen()
  127. print("Login")
  128. write("Username: ")
  129. username = read()
  130. clearScreen()
  131. print("Login")
  132. write("Password: ")
  133. pssw = read("*")
  134. password = sha256(pssw)
  135. clearScreen()
  136. modem.transmit(1,1,"balance`"..username.."`"..password)
  137.  
  138. modem.open(1)
  139. local _, side, freq, rfreq, message = os.pullEvent("modem_message")
  140. if message == "403" then
  141. print("Incorrect password!")
  142. else if message == "404" then
  143. print("There is no user called "..username.."!")
  144. else
  145. loggedOn(username,password,message)
  146. end
  147. end
  148. os.sleep(4)
  149. end
  150. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement