Skip to content

Commit b1e666e

Browse files
committed
added 2 scripts on generating password and otp
1 parent 82b78cb commit b1e666e

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Generate 6 digit OTP
2+
import string
3+
import secrets
4+
5+
number = string.digits
6+
otp = ''
7+
8+
for i in range (6):
9+
otp += ''.join(secrets.choice(number))
10+
11+
print(otp)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import string
2+
import secrets
3+
4+
letters = string.ascii_letters
5+
digits = string.digits
6+
special_chars = string.punctuation
7+
8+
# Alphabet is the combination of letters, digits and special characters
9+
alphabet = letters + digits + special_chars
10+
11+
# define password length
12+
password_len = 12
13+
14+
password = ''
15+
16+
for i in range(password_len):
17+
password += ''.join(secrets.choice(alphabet))
18+
19+
print(f"Password is: {password}")
20+

0 commit comments

Comments
 (0)