Generate a signature for a sequence of (key, value) pairs


        @param pairs: The pairs to sign, in order

        @type pairs: sequence of (str, str)


        @return: The binary signature of this sequence of pairs

        @rtype: str
769649
def sign(self, pairs):
        
        kv = kvform.seqToKV(pairs)

        try:
            mac = self._macs[self.assoc_type]
        except KeyError:
            raise ValueError(
                'Unknown association type: %r' % (self.assoc_type,))

        return mac(self.secret, kv)
627506
public static Map<String, Object> from(Pair... pairs) {
        Map<String, Object> map = new HashMap<String, Object>(pairs.length);
        for (Pair p : pairs) {
            map.put(p.key, p.value);
        }
        return map;
    }
1114997
function pairsToObject(pairs) {
    var result = {};
    pairs.forEach(function (_ref) {
        var _ref2 = _slicedToArray(_ref, 2);

        var key = _ref2[0];
        var val = _ref2[1];

        result[key] = val;
    });
    return result;
}
573808
def qubit_pairs_to_qubit_order(
    qubit_pairs: Sequence[Sequence[ops.Qid]]
    ) -> List[ops.Qid]:
    

    if set(len(qubit_pair) for qubit_pair in qubit_pairs) != set((2,)):
        raise ValueError(
            'set(len(qubit_pair) for qubit_pair in qubit_pairs) != '
            'set((2,))')
    n_pairs = len(qubit_pairs)
    qubits = [] # type: List[ops.Qid]
    for i in range(0, 2 * (n_pairs // 2), 2):
        qubits += [qubit_pairs[i][0], qubit_pairs[i + 1][0],
                   qubit_pairs[i][1], qubit_pairs[i + 1][1]]
    if n_pairs % 2:
        qubits += list(qubit_pairs[-1])
    return qubits
161006
def make_signature(params, hmac_key):
    
    # produce a list of "key=value" for all entries in params except `h'
    pairs = [x + "=" + ''.join(params[x]) for x in sorted(params.keys()) if x != "h"]
    sha = hmac.new(hmac_key, '&'.join(pairs), hashlib.sha1)
    return base64.b64encode(sha.digest())
482641
def iteritems(self):
        
        keys_yielded = set()
        for k, v in self._pairs:
            if k not in keys_yielded:
                keys_yielded.add(k)
                yield k, v
578136
def sign(jwk, plain_text, header = nil)
      protected_binary = JOSE.urlsafe_encode64(to_binary)
      payload = JOSE.urlsafe_encode64(plain_text)
      signing_input = signing_input(plain_text, protected_binary)
      signature = JOSE.urlsafe_encode64(alg.sign(jwk, signing_input))
      return signature_to_map(payload, protected_binary, header, jwk, signature)
    end
639903
function sign (transaction, keys) {
	var hash = getHash(transaction);
	var signature = naclInstance.crypto_sign_detached(hash, Buffer.from(keys.privateKey, 'hex'));

	if (!transaction.signature) {
		transaction.signature = Buffer.from(signature).toString('hex');
	} else {
		return Buffer.from(signature).toString('hex');
	}
}
194238
def sign(self, payload):
        
        nonce = str(int(time.time() * 1000))
        package = {'apikey': self.key,
                   'message': {'nonce': nonce, 'payload': payload}}

        signature = hmac.new(self.secret, json.dumps(payload).hexdigest,
                             hashlib.sha512).hexdigest()
        package['signature'] = signature

        return json.dumps(package)
1207890
def get_pair(self, term1, term2):

        

        key = self.key(term1, term2)
        return self.pairs.get(key, None)
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
491082
def make_otp_response(vres, client_key):
    
    if client_key is not None:
        sig = make_signature(vres, client_key)
        vres['h'] = sig
    # produce "key=value" pairs from vres
    pairs = [x + "=" + ''.join(vres[x]) for x in sorted(vres.keys())]
    return '\n'.join(pairs)
1162708
function multiSign (transaction, keys) {
	var bytes = getBytes(transaction, 'multisignature');
	var hash = crypto.createHash('sha256').update(bytes).digest();
	var signature = naclInstance.crypto_sign_detached(hash, Buffer.from(keys.privateKey, 'hex'));

	return Buffer.from(signature).toString('hex');
}
1188610
def encode_keys(self, keys):
        
        return dict(((k, self.encode(v)) for k, v in six.iteritems(keys) if not
                     is_null(v)))
247090
def sign(self, keys):
        
        key = keys[0]
        signed = self.raw()[-2:]
        signing = base64.b64encode(key.signature(bytes(signed, 'ascii')))
        self.signatures = [signing.decode("ascii")]
756669
def pairwise(iterable):
    
    iterator = iter(iterable)
    try:
        first = next(iterator)
    except StopIteration:
        return
    for element in iterator:
        yield first, element
        first = element
1201315
def encode(self, sequence):
		""""""
		
		polymorphisms = []
		defaultSequence = '' 
		binSequence = array.array(self.forma.typecode)
		b = 0
		i = 0
		trueI = 0 #not inc in case if poly
		poly = set()
		while i < len(sequence)-1:
			b = b | self.forma[self.charToBin[sequence[i]]]
			if sequence[i+1] == '/' :
				poly.add(sequence[i])
				i += 2
			else :
				binSequence.append(b)
				if len(poly) > 0 :
					poly.add(sequence[i])
					polymorphisms.append((trueI, poly))
					poly = set()
				
				bb = 0
				while b % 2 != 0 :
					b = b/2
					
				defaultSequence += sequence[i]
				b = 0
				i += 1
				trueI += 1
		
		if i < len(sequence) :
			b = b | self.forma[self.charToBin[sequence[i]]]
			binSequence.append(b)
			if len(poly) > 0 :
				if sequence[i] not in poly :
					poly.add(sequence[i])
				polymorphisms.append((trueI, poly))
			defaultSequence += sequence[i]
		
		return (binSequence, defaultSequence, polymorphisms)