在Python中使用salt加密密码时出错

2024-04-27 21:41:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用Python加密密码时出错。我在下面解释错误

Error:

Traceback (most recent call last):
  File "password.py", line 60, in <module>
    hashed_password = hashlib.sha512(sword + salt).hexdigest()
TypeError: cannot concatenate 'str' and 'list' objects

我的代码如下

import hashlib
value = "2Y7xk5vrs5DeCcSdinRVKQ=="
salt = value.split()
sword = "subhra1234"
hashed_password = hashlib.sha512(sword + salt).hexdigest()
print(hashed_password)

这里我需要使用自己的salt值并尝试加密密码。请帮助解决此错误


Tags: 密码mostvalue错误errorpasswordcallhashlib