I have this code, but i can't understand why i get this error:
TypeError: unsupported operand type(s) for +: '_sre.SRE_Match' and '_sre.SRE_Match'
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)
store_hash_and_salt = self.make_pw_hash("José", "somePass")
The problem is not there. Somewhere earlier you passed it the RE match results instead of using the
group() method to obtain the strings from them.
(Also, the format of the returned string is incorrect, but that's not the bug here.)