MCPcopy Index your code
hub / github.com/RustPython/RustPython / _CRAM_MD5_AUTH

Method _CRAM_MD5_AUTH

Lib/imaplib.py:723–736  ·  view source on GitHub ↗

Authobject to use with CRAM-MD5 authentication.

(self, challenge)

Source from the content-addressed store, hash-verified

721
722
723 def _CRAM_MD5_AUTH(self, challenge):
724 """ Authobject to use with CRAM-MD5 authentication. """
725 import hmac
726
727 if isinstance(self.password, str):
728 password = self.password.encode('utf-8')
729 else:
730 password = self.password
731
732 try:
733 authcode = hmac.HMAC(password, challenge, 'md5')
734 except ValueError: # HMAC-MD5 is not available
735 raise self.error("CRAM-MD5 authentication is not supported")
736 return f"{self.user} {authcode.hexdigest()}"
737
738
739 def logout(self):

Callers

nothing calls this directly

Calls 5

hexdigestMethod · 0.95
isinstanceFunction · 0.85
encodeMethod · 0.45
HMACMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected