title: Get signature key for aws s3 (ruby)
body: <p>I'm trying to run a script to get the hexadecimal representation of the aws signing key. But instead, I'm getting this on the terminal:</p>
  
  <pre><code>???&gt;?^?c???w?,????-??e??$C
  </code></pre>
  
  <p>What's wrong with my code?</p>
  
  <pre><code>#!/usr/bin/env ruby
  require 'openssl'
  def getSignatureKey key, dateStamp, regionName, serviceName
      kDate = OpenSSL::HMAC.digest('sha256', "AWS4" + key, dateStamp)
      kRegion = OpenSSL::HMAC.digest('sha256', kDate, regionName)
      kService = OpenSSL::HMAC.digest('sha256', kRegion, serviceName)
      kSigning = OpenSSL::HMAC.digest('sha256', kService, "aws4_request")
  
      kSigning
  end
  
  puts getSignatureKey('wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY','20170110', 'us-west-1', 's3')
  </code></pre>