-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.py
More file actions
28 lines (22 loc) · 1.11 KB
/
Copy pathsignup.py
File metadata and controls
28 lines (22 loc) · 1.11 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
import hashlib
import sqlite3
connection = sqlite3.connect("database_mine.db", timeout=10)
cursor = connection.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS database_mine (
id INTEGER PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL
)
""")
username = input("Enter a username: ")
password = input("Enter a password: ")
username1, password1 = "Treveen", hashlib.sha256("123".encode()).hexdigest()
username2, password2 = "John", hashlib.sha256("lovehacking".encode()).hexdigest()
username3, password3 = "Harold", hashlib.sha256("ipython".encode()).hexdigest()
username4, password4 = username, hashlib.sha256(password.encode()).hexdigest()
cursor.execute("INSERT INTO database_mine (username, password) VALUES (?, ?)", (username1, password1))
cursor.execute("INSERT INTO database_mine (username, password) VALUES (?, ?)", (username2, password2))
cursor.execute("INSERT INTO database_mine (username, password) VALUES (?, ?)", (username3, password3))
cursor.execute("INSERT INTO database_mine (username, password) VALUES (?, ?)", (username4, password4))
connection.commit()