Calculate the signatures for this MAR file.

        Returns:
            A list of signature tuples: [(algorithm_id, signature_data), ...]
353863
def calculate_signatures(self):
        
        if not self.signing_algorithm:
            return []

        algo_id = {'sha1': 1, 'sha384': 2}[self.signing_algorithm]
        hashers = [(algo_id, make_hasher(algo_id))]
        for block in get_signature_data(self.fileobj, self.filesize):
            [h.update(block) for (_, h) in hashers]

        signatures = [(algo_id, sign_hash(self.signing_key, h.finalize(), h.algorithm.name)) for (algo_id, h) in hashers]
        return signatures
772531
def get_signature_names(self):
        
        signature_expr = re.compile(r"^(META-INF/)(.*)(\.RSA|\.EC|\.DSA)$")
        signatures = []

        for i in self.get_files():
            if signature_expr.search(i):
                if "{}.SF".format(i.rsplit(".", 1)[0]) in self.get_files():
                    signatures.append(i)
                else:
                    log.warning("v1 signature file {} missing .SF file - Partial signature!".format(i))

        return signatures
463148
def _GetSignatureScanner(cls, specification_store):
    
    signature_scanner = pysigscan.scanner()
    signature_scanner.set_scan_buffer_size(cls._SCAN_BUFFER_SIZE)

    for format_specification in specification_store.specifications:
      for signature in format_specification.signatures:
        pattern_offset = signature.offset

        if pattern_offset is None:
          signature_flags = pysigscan.signature_flags.NO_OFFSET
        elif pattern_offset < 0:
          pattern_offset *= -1
          signature_flags = pysigscan.signature_flags.RELATIVE_FROM_END
        else:
          signature_flags = pysigscan.signature_flags.RELATIVE_FROM_START

        signature_scanner.add_signature(
            signature.identifier, pattern_offset, signature.pattern,
            signature_flags)

    return signature_scanner
115637
def add_response_signature(self, response_data, sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA1):
        
        return self.__build_signature(response_data, 'SAMLResponse', sign_algorithm)
732889
def target_signature(self):
        ''''''
        if self.exists():
            if not self._md5:
                self._md5 = fileMD5(self)
            return (os.path.getmtime(self), os.path.getsize(self), self._md5)
        elif (self + '.zapped').is_file():
            with open(self + '.zapped') as sig:
                line = sig.readline()
                _, mtime, size, md5 = line.strip().rsplit('\t', 3)
                self._md5 = md5
                return (float(mtime), int(size), md5)
        else:
            raise ValueError(f'{self} does not exist.')
136719
def get_committed_signatures(vcs):
    
    committed_path = _get_committed_history_path(vcs)
    known_signatures = []
    if os.path.exists(committed_path):
        with open(committed_path, 'r') as f:
            known_signatures = f.read().split()
    return known_signatures
840684
def get_property_names(self):
        '''
        
        '''
        property_names = set()
        for signature_value in self.values():
            for property_name in signature_value.keys():
                property_names.add(property_name)
        return property_names
661202
def _signature(self, cmd):
        '''
        
        '''
        result = {}

        client = cmd.get('client', 'minion')
        if client == 'minion':
            cmd['fun'] = 'sys.argspec'
            cmd['kwarg'] = dict(module=cmd['module'])
            result = self.run(cmd)
        elif client == 'master':
            parts = cmd['module'].split('.')
            client = parts[0]
            module = '.'.join(parts[1:])  # strip prefix
            if client == 'wheel':
                functions = self.wheelClient.functions
            elif client == 'runner':
                functions = self.runnerClient.functions
            result = {'master': salt.utils.args.argspec_report(functions, module)}
        return result
660438
def get_public_keys_der_v2(self):
        

        if self._v2_signing_data == None:
            self.parse_v2_signing_block()

        public_keys = []

        for signer in self._v2_signing_data:
            public_keys.append(signer.public_key)

        return public_keys
1312430
def signing_keys(self):
        
        if self._signing_keys is None:
            self._signing_keys = SigningKeyList(self._version, account_sid=self._solution['sid'], )
        return self._signing_keys
1300070
def computeImgSignature(image_data):
    
    parser = PIL.ImageFile.Parser()
    parser.feed(image_data)
    img = parser.close()
    target_size = (__class__.IMG_SIG_SIZE, __class__.IMG_SIG_SIZE)
    img.thumbnail(target_size, PIL.Image.BICUBIC)
    if img.size != target_size:
      logging.getLogger("Cover").debug("Non square thumbnail after resize to %ux%u, unable to compute signature" % target_size)
      return None
    img = img.convert(mode="RGB")
    pixels = img.getdata()
    pixel_count = target_size[0] * target_size[1]
    color_count = 3
    r = bitarray.bitarray(pixel_count * color_count)
    r.setall(False)
    for ic in range(color_count):
      mean = sum(p[ic] for p in pixels) // pixel_count
      for ip, p in enumerate(pixels):
        if p[ic] > mean:
          r[pixel_count * ic + ip] = True
    return r
248181
def list_sig_ok(self, signature: str):
        
        list_filename = self.get_list_filename(signature)
        if list_filename not in self.name_cache:
            return False
        for _object_name, sig in Cache.iterate_objects(list_filename):
            if not self.get_object_filename(sig):
                return False
        return True
571687
def calculate_signature(self, node, sign=True):
        
        signed_info_xml = node.find('ds:SignedInfo',
                                    namespaces=constants.NS_MAP)
        canonicalization_method = signed_info_xml.find(
            'ds:CanonicalizationMethod', namespaces=constants.NS_MAP
        ).get('Algorithm')
        signature_method = signed_info_xml.find(
            'ds:SignatureMethod', namespaces=constants.NS_MAP
        ).get('Algorithm')
        if signature_method not in constants.TransformUsageSignatureMethod:
            raise Exception('Method ' + signature_method + ' not accepted')
        signature = constants.TransformUsageSignatureMethod[signature_method]
        signed_info = self.canonicalization(
            canonicalization_method, signed_info_xml
        )
        if not sign:
            signature_value = node.find('ds:SignatureValue',
                                        namespaces=constants.NS_MAP).text
            public_key = signature['method'].get_public_key(node, self)
            signature['method'].verify(
                signature_value,
                signed_info,
                public_key,
                signature['digest']
            )
        else:
            node.find(
                'ds:SignatureValue', namespaces=constants.NS_MAP
            ).text = b64_print(base64.b64encode(
                signature['method'].sign(
                    signed_info,
                    self.private_key,
                    signature['digest']
                )
            ))
522719
def _set_scatter_signature(self):
        
        self._scatter_signature = (self.thet0, self.thet, self.phi0, self.phi,
            self.alpha, self.beta, self.orient)
260701
def signature(self, name, file_name, file_type, file_content, owner=None, **kwargs):
        
        return Signature(self.tcex, name, file_name, file_type, file_content, owner=owner, **kwargs)
1139275
def geometry_identifiers(self):
        
        identifiers = {mesh.identifier_md5: name
                       for name, mesh in self.geometry.items()}
        return identifiers
98132
def calculate_signature(key, data, timestamp=None):
    
    # Create a timestamp if one was not given
    if timestamp is None:
        timestamp = int(time.time())

    # Construct the message from the timestamp and the data in the request
    message = str(timestamp) + ''.join("%s%s" % (k,v) for k,v in sorted(data.items()))

    # Calculate the signature (HMAC SHA256) according to RFC 2104
    signature = hmac.HMAC(str(key), message, hashlib.sha256).hexdigest()

    return signature