#31719: Remaining data.decode('ascii') @ hashers.py, but data is a str
-------------------------------------+-------------------------------------
Reporter: Marcel | Owner: nobody
Nogueira d' Eurydice |
Type: Bug | Status: new
Component: | Version: 3.0
contrib.auth | Keywords: string, decode,
Severity: Normal | python3
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
BCryptSHA256PasswordHasher class method enconde tries to decode data, but
data is a str. In Python3 a str instance does not have a decode method.
{{{
def encode(self, password, salt):
bcrypt = self._load_library()
password = password.encode()
# Hash the password prior to using bcrypt to prevent password
# truncation as described in #20138.
if self.digest is not None:
# Use binascii.hexlify() because a hex encoded bytestring is
str.
password = binascii.hexlify(self.digest(password).digest())
data = bcrypt.hashpw(password, salt)
return "%s$%s" % (self.algorithm, data.decode('ascii'))
}}}
the return statement should be
{{{
return "%s$%s" % (self.algorithm, data)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31719>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.e4cb08330e9b507406611aaf0f202d3b%40djangoproject.com.