Using HMAC SHA256 in Ruby

According to the documentation OpenSSL::HMAC.digest Returns the authentication code an instance represents as a binary string. If you have a problem using that maybe you need a hex encoded form provided by OpenSSL::HMAC.hexdigest Example key = ‘key’ data=”The quick brown fox jumps over the lazy dog” digest = OpenSSL::Digest.new(‘sha256’) OpenSSL::HMAC.digest(digest, key, data) #=> “\xF7\xBC\x83\xF40S\x84$\xB12\x98\xE6\xAAo\xB1C\xEFMY\xA1IF\x17Y\x97G\x9D\xBC-\x1A<\xD8” OpenSSL::HMAC.hexdigest(digest, … Read more

Contact us functionality in Rails 3

This tutorial is an excellent example – and it’s Rails 3 Update: This article is a better example than the one I posted earlier, works flawlessly Second Update: I would also recommend merging-in some of the techniques outlined in this railscast on the active_attr gem, where Ryan Bates walks you through the process of setting … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)