make a set of params to match the signature
173868
function fixSignatureParams(node, item, signature) {
  signature.params = [];
  for (var i = 0; i < signature.arity; i++) {
    var paramCopy = _.extend({}, item.params[i]);
    if (node && node.paramTags) {
      if (node.paramTags[paramCopy.name]) {
        _.extend(paramCopy, node.paramTags[paramCopy.name]);
      }
    }
    signature.params.push(paramCopy);
  }
}
1288213
def _sign(self,params):
        '''
        
        '''
        for k, v in params.iteritems():
            if type(v) == int: v = str(v)
            elif type(v) == float: v = '%.2f'%v
            elif type(v) in (list, set): 
                v = ','.join([str(i) for i in v])
            elif type(v) == bool: v = 'true' if v else 'false'
            elif type(v) == datetime.datetime: v = v.strftime('%Y-%m-%d %X')
            if type(v) == unicode:
                params[k] = v.encode('utf-8')
            else:
                params[k] = v
        src = self.APP_SECRET + ''.join(["%s%s" % (k, v) for k, v in sorted(params.iteritems())])
        return md5(src).hexdigest().upper()
833626
def parse_method_signature(sig):
    
    match = METH_SIG_RE.match(sig.strip())
    if not match:
        raise RuntimeError('Method signature invalid: ' + sig)
    modifiers, return_type, name, generic_types, params = match.groups()
    if params.strip() != '':
        params = split_sig(params)
        params = [parse_param_signature(x) for x in params]
    else:
        params = []
    return (modifiers.split(), return_type, name, generic_types, params)
341759
def get_signature_string(params, secret):
    
    str_list = [str(item) for item in extract_params(params)]
    str_list.sort()
    return (secret + ''.join(str_list)).encode('utf-8')
1364763
def _create_signing_params(self, url, keypair_id,
                          expire_time=None, valid_after_time=None,
                          ip_address=None, policy_url=None,
                          private_key_file=None, private_key_string=None):
        
        params = {}
        # Check if we can use a canned policy
        if expire_time and not valid_after_time and not ip_address and not policy_url:
            # we manually construct this policy string to ensure formatting
            # matches signature
            policy = self._canned_policy(url, expire_time)
            params["Expires"] = str(expire_time)
        else:
            # If no policy_url is specified, default to the full url.
            if policy_url is None:
                policy_url = url
            # Can't use canned policy
            policy = self._custom_policy(policy_url, expires=expire_time,
                                         valid_after=valid_after_time,
                                         ip_address=ip_address)

            encoded_policy = self._url_base64_encode(policy)
            params["Policy"] = encoded_policy
        #sign the policy
        signature = self._sign_string(policy, private_key_file, private_key_string)
        #now base64 encode the signature (URL safe as well)
        encoded_signature = self._url_base64_encode(signature)
        params["Signature"] = encoded_signature
        params["Key-Pair-Id"] = keypair_id
        return params
232275
def compute_signature params
      if $DEBUG
        puts "keys before sorted: #{params.keys}"
      end

      sorted_keys = params.keys.sort

      if $DEBUG
        puts "keys after sorted: #{sorted_keys}"
      end

      canonicalized_query_string = ""

      canonicalized_query_string = sorted_keys.map {|key|
        "%s=%s" % [safe_encode(key.to_s), safe_encode(params[key])]
      }.join(self.service.separator)

      length = canonicalized_query_string.length

      string_to_sign = self.service.http_method + self.service.separator + safe_encode('/') + self.service.separator + safe_encode(canonicalized_query_string)

      if $DEBUG
        puts "string_to_sign is #{string_to_sign}"
      end

      signature = calculate_signature access_key_secret+"&", string_to_sign
    end
712052
def calculated_sign
      params = SIGN_PARAMS.each_with_object({}) do |p, h|
        h[p] = send(p).tap { |v| v ? v.to_s : nil }
      end
      Signature.new(params, @secret).sign.upcase
    end
279267
function parseArgs(signature) {
  var args = [];
  var count = {};
  var index = {};
  var length = signature.length;
  for (var i = 0; i < length; i++) {
    var arg = signature[i];
    if (count[arg]) {
      count[arg]++;
    } else {
      count[arg] = 1;
    }
    index[arg] = 0;
  }
  for (var i = 0; i < length; i++) {
    var arg = signature[i];
    if (count[arg] > 1) {
      args.push(arg + "" + index[arg]);
      index[arg]++;
    } else {
      args.push(arg);
    }
  }
  return args
}
222490
def _build_signature(self):
        """"""
        sig_contents = \
            self.payload + "." + \
            b64encode(b"application/xml").decode("ascii") + "." + \
            b64encode(b"base64url").decode("ascii") + "." + \
            b64encode(b"RSA-SHA256").decode("ascii")
        sig_hash = SHA256.new(sig_contents.encode("ascii"))
        cipher = PKCS1_v1_5.new(self.private_key)
        sig = urlsafe_b64encode(cipher.sign(sig_hash))
        key_id = urlsafe_b64encode(bytes(self.author_handle, encoding="utf-8"))
        return sig, key_id
1017365
def parameters_signature(self):
        '''
            
        '''
        # Use x.type
        # x.name may be empty
        params = ",".join([str(x.type) for x in self._params])
        return '({})'.format(params)
1134745
def _get_signed_params(conv):
    
    conv["sign_mask"] = 2 ** (conv["bits"] - 1)
    conv["int_min"] = -1 * (2 ** (conv["bits"] - 1 - conv["bin_point"]))
    conv["int_mask"] = sum([2 ** i 
        for i in range(conv["bin_point"], conv["bits"] - 1)])
    conv["int_max"] = sum([2 ** i for i in range(conv["bits"] -
        conv["bin_point"] - 1)])
966355
def _compute_signature(parameters, access_key_secret):
    '''
    
    '''

    def percent_encode(line):
        if not isinstance(line, six.string_types):
            return line

        s = line
        if sys.stdin.encoding is None:
            s = line.decode().encode('utf8')
        else:
            s = line.decode(sys.stdin.encoding).encode('utf8')
        res = _quote(s, '')
        res = res.replace('+', '%20')
        res = res.replace('*', '%2A')
        res = res.replace('%7E', '~')
        return res

    sortedParameters = sorted(list(parameters.items()), key=lambda items: items[0])

    canonicalizedQueryString = ''
    for k, v in sortedParameters:
        canonicalizedQueryString += '&' + percent_encode(k) \
            + '=' + percent_encode(v)

    # All aliyun API only support GET method
    stringToSign = 'GET&%2F&' + percent_encode(canonicalizedQueryString[1:])

    h = hmac.new(to_bytes(access_key_secret + "&"), stringToSign, sha1)
    signature = base64.encodestring(h.digest()).strip()
    return signature
1193384
def parameters_for_signature
      params = []
      params << options[:parameters].to_query if options[:parameters]

      unless options[:clobber_request]
        params << header_params.to_query
        params << request.query_string unless query_string_blank?

        if request.post? && request.content_type.to_s.downcase.start_with?("application/x-www-form-urlencoded")
          params << request.raw_post
        end
      end

      params.
        join('&').split('&').
        reject { |s| s.match(/\A\s*\z/) }.
        map { |p| p.split('=').map{|esc| CGI.unescape(esc)} }.
        reject { |kv| kv[0] == 'oauth_signature'}
    end
924221
function(param_, test) {
  var param = param_.replace(/\s+/g, '')
    , cap;

  if (param === 'even') {
    param = '2n+0';
  } else if (param === 'odd') {
    param = '2n+1';
  } else if (param.indexOf('n') === -1) {
    param = '0n' + param;
  }

  cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param);

  return {
    group: cap[1] === '-'
      ? -(cap[2] || 1)
      : +(cap[2] || 1),
    offset: cap[4]
      ? (cap[3] === '-' ? -cap[4] : +cap[4])
      : 0
  };
}
951396
function encodeParams(params) {
    var queryString;
    if (params && Object.keys(params)) {
        queryString = [].slice.call(arguments).reduce(function (a, b) {
            return a.concat(b instanceof Array ? b : [b]);
        }, []).filter(function (c) {
            return "object" === typeof c;
        }).reduce(function (p, c) {
            !(c instanceof Array) ? p = p.concat(Object.keys(c).map(function (key) {
                return [key, c[key]];
            })) : p.push(c);
            return p;
        }, []).reduce(function (p, c) {
            c.length === 2 ? p.push(c) : p = p.concat(c);
            return p;
        }, []).reduce(function (p, c) {
            c[1] instanceof Array ? c[1].forEach(function (v) {
                p.push([c[0], v]);
            }) : p.push(c);
            return p;
        }, []).map(function (c) {
            c[1] = encodeURIComponent(c[1]);
            return c.join("=");
        }).join("&");
    }
    return queryString;
}
1126906
def prepare_params(params)
      # Create a new hash in case is a HashWithIndifferentAccess (keys are
      # always a String)
      params = Utils.symbolize_keys(Hash[params])
      # Only pull out the relevant parameters, other won't be included in the
      # signature so will cause false negatives
      keys = [:resource_id, :resource_type, :resource_uri, :state, :signature]
      params = Hash[params.select { |k,v| keys.include? k }]
      (keys - [:state]).each do |key|
        raise ArgumentError, "Parameters missing #{key}" if !params.key?(key)
      end
      params
    end
362417
def signature(self):
        """"""
        if self.usage is not None:
            return self.usage


        params = self.clean_params
        if not params:
            return ''

        result = []
        for name, param in params.items():
            greedy = isinstance(param.annotation, converters._Greedy)

            if param.default is not param.empty:
                # We don't want None or '' to trigger the [name=value] case and instead it should
                # do [name] since [name=None] or [name=] are not exactly useful for the user.
                should_print = param.default if isinstance(param.default, str) else param.default is not None
                if should_print:
                    result.append('[%s=%s]' % (name, param.default) if not greedy else
                                  '[%s=%s]...' % (name, param.default))
                    continue
                else:
                    result.append('[%s]' % name)

            elif param.kind == param.VAR_POSITIONAL:
                result.append('[%s...]' % name)
            elif greedy:
                result.append('[%s]...' % name)
            elif self._is_typing_optional(param.annotation):
                result.append('[%s]' % name)
            else:
                result.append('<%s>' % name)

        return ' '.join(result)