Only works for RSAPublic Keys

    :param key1:
    :param key2:
    :return:
431633
def rsa_eq(key1, key2):
    
    pn1 = key1.public_numbers()
    pn2 = key2.public_numbers()
    # Check if two RSA keys are in fact the same
    if pn1 == pn2:
        return True
    else:
        return False
440007
def _keyring_equivalent(keyring_one, keyring_two):
    
    def keyring_extract_key(file_path):
        """
        Cephx keyring files may or may not have white space before some lines.
        They may have some values in quotes, so a safe way to compare is to
        extract the key.
        """
        with open(file_path) as f:
            for line in f:
                content = line.strip()
                if len(content) == 0:
                    continue
                split_line = content.split('=')
                if split_line[0].strip() == 'key':
                    return "=".join(split_line[1:]).strip()
        raise RuntimeError("File '%s' is not a keyring" % file_path)
    key_one = keyring_extract_key(keyring_one)
    key_two = keyring_extract_key(keyring_two)
    return key_one == key_two
900164
def key_sign(rsakey, message, digest):
    """"""
    padding = _asymmetric.padding.PKCS1v15()
    signature = rsakey.sign(message, padding, digest)
    return signature
653898
function haveDifferentKeys(object1, object2) {
  var keys1 = Object.keys(object1);
  var keys2 = Object.keys(object2);

  if (keys1.length !== keys2.length) {
    return true;
  }

  return !keys1.every(function existsInKeys2 (key) {
    return keys2.indexOf(key) !== -1;
  });
}
382927
private int compare(Object key1, Object key2) {
        if (comparator == null)
            return ((Comparable) key1).compareTo(key2);
        else
            return comparator.compare(key1, key2);
    }
35208
def load_key(self, key_path, password):
        

        try:
            return paramiko.RSAKey.from_private_key_file(key_path)
        except PasswordRequiredException as ex:
            return paramiko.RSAKey.from_private_key_file(key_path,
                                                         password=password)
446609
def getKey(self, key):
		
		data = self.getDictionary()
		if key in data:
			return data[key]
		else:
			return None
979642
def newkeys(nbits=1024):
        
        pubkey, privkey = rsa.newkeys(nbits, poolsize=1)
        return pubkey, privkey
53068
def _assert_keys_match(keys1, keys2):
  """"""
  if set(keys1) != set(keys2):
    raise ValueError('{} {}'.format(list(keys1), list(keys2)))
917429
def fromkeys(cls, seq, value=None, **kwargs):
        
        other = cls(**kwargs)
        other.update(((key, value) for key in seq))

        return other
436352
def _qualified_key(self, key):
        
        pfx = self.key_prefix if self.key_prefix is not None else ''
        return '{}{}'.format(pfx, key)
1363021
def _pairs(keys, *, start=1, sep=' AND '):
    '''
    
    '''
    return sep.join('{}=${}'.format(k, i) for i, k in enumerate(keys, start))
53981
def __convert_keys_1(self, header, d):
        
        d2 = {}
        try:
            for k, v in d.items():
                try:
                    d2[self.__get_noaa_key_w_context(header, k)] = v
                except KeyError:
                    pass
        except Exception:
            return d
        return d2
44354
def starts_with(self, other: 'Key') -> bool:
        
        if (self.key_type, self.identity, self.group) != (other.key_type, other.identity,
                                                          other.group):
            return False
        if self.key_type == KeyType.TIMESTAMP:
            return True
        if self.key_type == KeyType.DIMENSION:
            if len(self.dimensions) < len(other.dimensions):
                return False
            return self.dimensions[0:len(other.dimensions)] == other.dimensions
464214
def hash_key(self, key):
        
        for i, destination_key in enumerate(self._dict):
            if key < destination_key:
                return destination_key

        return key
671338
def _map_and_prefix_keys(self, key_iterable, key_prefix):
        
        # Check it just once ...
        key_extra_len=len(key_prefix)
        if key_prefix and self.do_check_key:
            self.check_key(key_prefix)

        # server (_Host) -> list of unprefixed server keys in mapping
        server_keys = {}

        prefixed_to_orig_key = {}
        # build up a list for each server of all the keys we want.
        for orig_key in key_iterable:
            if isinstance(orig_key, tuple):
                # Tuple of hashvalue, key ala _get_server(). Caller is essentially telling us what server to stuff this on.
                # Ensure call to _get_server gets a Tuple as well.
                str_orig_key = str(orig_key[1])
                server, key = self._get_server((orig_key[0], key_prefix + str_orig_key)) # Gotta pre-mangle key before hashing to a server. Returns the mangled key.
            else:
                str_orig_key = str(orig_key) # set_multi supports int / long keys.
                server, key = self._get_server(key_prefix + str_orig_key)

            # Now check to make sure key length is proper ...
            if self.do_check_key:
                self.check_key(str_orig_key, key_extra_len=key_extra_len)

            if not server:
                continue

            if server not in server_keys:
                server_keys[server] = []
            server_keys[server].append(key)
            prefixed_to_orig_key[key] = orig_key

        return (server_keys, prefixed_to_orig_key)
2025
def set_pair(self, term1, term2, value, **kwargs):

        

        key = self.key(term1, term2)
        self.keys.update([term1, term2])
        self.pairs[key] = value