Obfuscate strings in Python

后端 未结 6 1366
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 08:54

I have a password string that must be passed to a method. Everything works fine but I don\'t feel comfortable storing the password in clear text. Is there a way to obfuscate

6条回答
  •  臣服心动
    2021-01-02 09:26

    It depends alot on why you're keeping the password around, and where you feel there is a security issue.

    If you're storing or matching this password to a database in the future:

    This shouldn't really be a problem, but if you're concerned, use your database's password encryption early and store that ( SELECT PASSWORD('mySamplePassword'); ), then compare the encrypted version directly in your later query.

    If you're saving it for later transmision:

    There really isn't much you can do. The transmission itself is very likely to be easier to sniff than your handling of the password.

    Without knowing a few more details of what you're doing, this is sortof hard to answer.

提交回复
热议问题