code: function signRequest(method, url, params, secret){
      //
      // normalize request method
      method = method.toUpperCase();
      if(!(method === 'POST' || method === 'GET')){
          throw new Error('Request method should either Post or Get and you passed "' + method + '"');
      }
      params = params || {};
      //
      // form the parameters string
      var paramStr = '';
      var keys = [];
      for(v in params){
          keys.push(v);
      }
      keys.sort();
      for(var i = 0; i < keys.length; i++){
          paramStr += keys[i] + '=' + params[keys[i]];
      }
      var basicString = method + url + paramStr + secret;
      //console.log('basic string: ' + basicString);
      var encoded = URLEncode(basicString);
  
      var md5 = crypto.createHash('md5');
      md5.update(encoded);
      var sign = md5.digest('hex');
      var body = '';
      for(v in params){
          body += URLEncode(v) + '=' + URLEncode(params[v]) + '&';
      }
      body += 'sign=' + sign; //append the signature
      return body;
  }
docs: check the sign algorithm at: http://developer.baidu.com/wiki/index.php?title=docs/cplat/mq/sign method : POST or GET