public function sign($data) {
    /* Remove signature from server. */
    unset($data['h']);

    /* Sort keys alphabetically. */
    ksort($data);

    /* Build query string to sign. */
    $n = count($data);
    $query = '';
    $i = 0;
    while(list($key, $val) = each($data)) {
      $i++;
      $query .= $key.'='.$val;
      if($i < $n) {
        $query.= '&';
      }
    }

    /* Sign. */
    $sign = hash_hmac('sha1', utf8_encode($query), base64_decode($this->clientSecret), true);
    return base64_encode($sign);
  }
public function sign($data) {
    /* Remove signature from server. */
    unset($data['h']);

    /* Sort keys alphabetically. */
    ksort($data);

    /* Build query string to sign. */
    $n = count($data);
    $query = '';
    $i = 0;
    while(list($key, $val) = each($data)) {
      $i++;
      $query .= $key.'='.$val;
      if($i < $n) {
        $query.= '&';
      }
    }

    /* Sign. */
    $sign = hash_hmac('sha1', utf8_encode($query), base64_decode($this->clientSecret), true);
    return base64_encode($sign);
  }
public function sign ( $ data ) { /* Remove signature from server. */ unset ( $ data [ 'h' ] ) ; /* Sort keys alphabetically. */ ksort ( $ data ) ; /* Build query string to sign. */ $ n = count ( $ data ) ; $ query = '' ; $ i = 0 ; while ( list ( $ key , $ val ) = each ( $ data ) ) { $ i ++ ; $ query .= $ key . '=' . $ val ; if ( $ i < $ n ) { $ query .= '&' ; } } /* Sign. */ $ sign = hash_hmac ( 'sha1' , utf8_encode ( $ query ) , base64_decode ( $ this -> clientSecret ) , true ) ; return base64_encode ( $ sign ) ; }
Sign data using shared secret.

@param array $data
Data to sign.

@return string
Base64 encoded HMAC hash.
Sign data using shared secret .