stormist
stormist

Reputation: 5905

Translating algorithm/code from Ruby to PHP

digest = HMAC.digest(Digest.new(SHA1), Base64.decode64(key), HashString) return Base64.encode64(digest.to_s()).chomp()

What would the above be in PHP?

Upvotes: 1

Views: 159

Answers (1)

caf
caf

Reputation: 239011

This should do it:

$digest = hash_hmac("sha1", $hash_string, base64_decode($key), true);
return base64_encode($digest);

Upvotes: 2

Related Questions