جواب «Login Without Storing the Password» چالش 3 از جلسهی 9
سؤال
متغیر stored هش رمز درست است (رمز خودش هیچجا نیست!). رمز را با input بگیر، هشش را حساب کن و اگر با stored یکی بود چاپ کن welcome! وگرنه wrong password.
راهنما
if hashlib.sha256(typed.encode()).hexdigest() == stored:
یک جواب درست
import hashlib
stored = "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
typed = input()
if hashlib.sha256(typed.encode()).hexdigest() == stored:
print("welcome!")
else:
print("wrong password")
اول خودت امتحان کن؛ جوابهای دیگر هم قبول است. برگرد و خودت حلش کن