🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.random.randint(100000, 999999)
  2. B.str(time.time())
  3. C.hashlib.md5(email).hexdigest()
  4. 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 →