grandfathermagic

bank 2.0

May 12th, 2020
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.94 KB | None | 0 0
  1. ###################################
  2. # This is the Givov Function: will get password string and return out_put_hash
  3.  
  4.  
  5. def my_hash(string):
  6.     i = 0
  7.     temp_hash = 1
  8.     while i < len(string):
  9.         temp_hash = (temp_hash * ord(string[i])) * (i + 1) % 397643
  10.         i += 1
  11.  
  12.     out_put_hash = temp_hash % 100297
  13.     return out_put_hash
  14.  
  15.  
  16. # תוכנה זו תציג למשתמש ברכה ולאחר מכן תבקש ממנו משתמש וסיסמא ותגיב בהתאם למה שיכניס
  17. print("Dear user, welcome to our system")
  18. print("Before you will be able to login you will need to first...")
  19.  
  20.  
  21. def check_user_and_password(username, password):
  22.     from time import sleep
  23.     try_again = 0
  24.     while try_again == 0:
  25.         # username = input("Enter your user name ")
  26.         if username != "wrong" and username != "admin":
  27.             print("No Such user")
  28.             try_again = 0
  29.             print("you will need to try something else\n\n\n")
  30.             sleep(2.0)
  31.             username = input("Enter a new user name")
  32.             continue
  33.  
  34.         else:
  35.             print("I have got your input\n \n \n")
  36.             if username == "wrong" or "admin":
  37.                 print("Great ! this user is available")
  38.                 if (username == "wrong" and password == "ads sports") or (
  39.                         username == "admin" and password == "is traitor"):
  40.                     print("you are now logged in")
  41.                     try_again = 1
  42.                 else:
  43.                     print("one  or both of the details are wrong")
  44.                     try_again = 0
  45.                     username = input("Enter a new user name")
  46.                     password = input("Enter your Password please")
  47.  
  48.  
  49. user_input = input("what is the user name you are trying to log with? ")
  50. password_input = input("what is the password of the user?")
  51. check_user_and_password(user_input, password_input)
  52.  
  53. print(my_hash("my name is Ran"))
Add Comment
Please, Sign In to add comment