🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Password Storage Lab: all 10 questions

Quiz: Password Storage Lab · Question 5 of 10

What does this print? (code)

What does this print?

import hashlib
a = hashlib.pbkdf2_hmac("sha256", b"pw", b"salt-one", 1000).hex()
b = hashlib.pbkdf2_hmac("sha256", b"pw", b"salt-two", 1000).hex()
c = hashlib.pbkdf2_hmac("sha256", b"pw", b"salt-one", 1000).hex()
print(a == b, a == c)
  1. A.True True
  2. B.False False
  3. C.False True
  4. D.True False
Answer & explanation

Correct answer: False True

A different salt gives a different hash; the same inputs always give the same hash.

Can you get the rest right without peeking?

Take the timed Quiz: Password Storage Lab quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →