-1
我在使用Python加密密码时出错。我正在解释下面的错误。在Python中使用salt编写密码时出现错误
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值,并试图加密密码。请帮助解决此错误。
你为什么要拆分'salt'?你知道什么'str.split'吗?它产生一个列表... –
否则它抛出相同的错误,像'TypeError:不能连接'str'和'list''。你能分享解决方案吗? – subhra