title: Using HMAC SHA256 in Ruby
body: <p>I'm trying to apply HMAC-SHA256 for generate a key for an Rest API.</p>
  
  <p>I'm doing something like this:</p>
  
  <pre><code>def generateTransactionHash(stringToHash)
    key = '123'
    data = 'stringToHash'
    digest = OpenSSL::Digest.new('sha256')
  
    hmac = OpenSSL::HMAC.digest(digest, key, data)
    puts hmac
  end
  </code></pre>
  
  <p>The output of this is always this: (if I put '12345' as parameter or 'HUSYED815X', I do get the same)</p>
  
  <pre><code>ۯw/{o���p�T����:��a�h��E|q
  </code></pre>
  
  <p>The API is not working because of this... Can some one help me with that?</p>