← Quiz: Cryptography Basics: all 10 questions
Quiz: Cryptography Basics · Question 9 of 10
Which is the correct way to generate a password-reset token in Python?
Which is the correct way to generate a password-reset token in Python?
- A.random.randint(100000, 999999)
- B.str(time.time())
- C.hashlib.md5(email).hexdigest()
- D.secrets.token_urlsafe(32)
Answer & explanation
Correct answer: secrets.token_urlsafe(32)
secrets uses a cryptographically secure generator; the others are predictable.
Can you get the rest right without peeking?
Take the timed Quiz: Cryptography Basics quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →