我有这段代码,但我不明白为什么会出现这个错误:
a= name+pw+salt
TypeError: unsupported operand type(s) for +: '_sre.SRE_Match' and '_sre.SRE_Match'
脚本
class MainHandler(Handler):
def make_salt(self):
return ''.join(random.choice(string.ascii_letters) for x in range(5))
def make_pw_hash(self, name, pw):
salt = self.make_salt()
a= name+pw+salt //problem here
h = hashlib.sha256(a.encode("UTF8")).hexdigest()
return '%s|%s' % (h, salt)
def post(self):
store_hash_and_salt = self.make_pw_hash("José", "somePass")
print (store_hash_and_salt)