Merge pull request #1219 from mithodin/9733-mithodin-digestmod

Author: mithodin

Reviewer: glyph

Fixes: ticket:9733

CramMD5ClientAuthenticator now specifies the digestmod argument to hmac.HMAC constructor explicitly.
This commit is contained in:
Glyph 2020-01-27 16:44:27 -08:00 committed by GitHub
commit b4602e5e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@ Credential managers for L{twisted.mail}.
from __future__ import absolute_import, division
import hmac
import hashlib
from zope.interface import implementer
@ -28,8 +29,8 @@ class CramMD5ClientAuthenticator:
def challengeResponse(self, secret, chal):
response = hmac.HMAC(secret, chal).hexdigest().encode('ascii')
return self.user + b' ' + response
response = hmac.HMAC(secret, chal, digestmod=hashlib.md5).hexdigest()
return self.user + b' ' + response.encode('ascii')

View File