-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
57 lines (40 loc) · 1.13 KB
/
main.py
File metadata and controls
57 lines (40 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import sys;
import math;
import getpass;
import json;
import random;
import data_types;
import data_hash;
data_types.printDataTypes();
print(random.randrange(1, 10));
login = input('Login:');
if login != 'nmatch':
print('Unknown user');
sys.exit();
hash = '926db1abcfac5c99087179b74cc9c91388032656f1299fef1e637d20a548eed1';
attempts = 0;
while True:
password = getpass.getpass('Password:');
passwordConfirmation = getpass.getpass('Confirm Password:');
if attempts > 2:
print('You tried too many times... Exiting');
sys.exit();
if password != passwordConfirmation:
print('Password does not match');
attempts += 1;
continue;
passwordHash = data_hash.getHash(passwordConfirmation);
if passwordHash != hash:
print('Unauthorized. Password is incorrect. Try again');
attempts += 1;
continue;
break;
print('Successfully authorized! Welcome, ' + login + '!');
while True:
print("x * x = ");
value = input('Enter x:');
if value == 'exit':
sys.exit();
x = int(value);
result = math.pow(x, 2);
print(result);