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