title: How to get PHP to create HMAC-SHA1 strings like Objective-C?
body: <p>I am trying to implement an authentication solution with PHP and Objective-C. Both languages create their own HMAC-SHA1 encoded strings with the same key and the same secret.</p>
  <p>Apparently they seem to differ in their way how they do it.</p>
  <p>On Objective-C side I am using OAuthCustomer as signing class which produces the correct looking encoded string:</p>
  <pre><code>/3n/d4sKN6k3I7nBm1qau59UukU=
  </code></pre>
  <p>On PHP side I am using the built-in function hash_hmac('sha1',...) with base64 encoding which produces this:</p>
  <pre><code>ZmY3OWZmNzc4YjBhMzdhOTM3MjNiOWMxOWI1YTlhYmI5ZjU0YmE0NQ==
  </code></pre>
  <p>Then I have tried to use another function (mentioned <a href="http://www.php.net/manual/en/function.sha1.php#39492" rel="noreferrer">here</a>) and this produces with base64 encoding this:</p>
  <pre><code>NWY1ODUwOWE3NGI4NWU5ZTIxMDYzMTNmNzk3NTYxMDQ4OWE1MmUzNQ==
  </code></pre>
  <p>I have absolutely no idea how I can fix this issue and I don't even know why this happens.</p>
  <p>Thanks a bunch for help,</p>
  <p>Paul</p>