def verify_response(self, request, response):
        if not self._digest_offset_extractor:
            return self.verify_simple_response(request, response)

        # extract the digest embedded in request
        offset = self._digest_offset_extractor(request)
        req_digest = buffer(request, offset, 32)

        # calculate what would have to be the digest of the request
        # digest calculated by the peer
        key = self.select_other_key()
        digest_key = _hmac(key, req_digest)

        # calculate our version of the response digest
        digest = _hmac(digest_key, buffer(response, 0, 32 - self.packet_bytes))

        # print 'verify_response (%s)' % (('relaxed', 'strict')[self.strict])
        # print 'other:', response[-32:].encode('hex')
        # print ' mine:', digest.encode('hex')
        # print '   ==:', response[-32:] == digest

        if not self.strict:
            # in relaxed mode, just say it's all good
            return True

        # the response and our digests should match
        return buffer(response, len(response) - 32) == buffer(digest)
dataset/ETHPy150Open arkadini/twimp/twimp/crypto/handshake.py/CryptoHandshaker.verify_response/swapped operands of `-`