Python Password Protection

前端 未结 8 1638
长情又很酷
长情又很酷 2020-12-16 20:23

I am a beginner so if this question sounds stupid, please bear with me.

I am wondering that when we write code for username/password check in python, if it is not c

8条回答
  •  别那么骄傲
    2020-12-16 20:58

    One way would be to store the password in a hash form of any algorithm and check if the hash of the password given is equal to the stored password hash.

    The second way might be to take a password like "cat" and convert them to ascii and and add them up and store the sum. Then you can compare the given password's ascii sum to the one you stored.

    OR you can combine them both! Maybe also hash the ascii sum and compare the given pass word's ascii sun's hash.

    These are the three ways I know at least. And you can use chr or ord default function in python to convert to and back repeatedly to ascii. And you can use hashlib to hash.

提交回复
热议问题