method
hmac_md5
v1_9_1_378 -
Show latest stable
- Class:
Net::IMAP::CramMD5Authenticator
hmac_md5(text, key)private
No documentation available.
# File lib/net/imap.rb, line 3197
def hmac_md5(text, key)
if key.length > 64
key = Digest::MD5.digest(key)
end
k_ipad = key + "\00"" * (64 - key.length)
k_opad = key + "\00"" * (64 - key.length)
for i in 0..63
k_ipad[i] = (k_ipad[i].ord ^ 0x36).chr
k_opad[i] = (k_opad[i].ord ^ 0x5c).chr
end
digest = Digest::MD5.digest(k_ipad + text)
return Digest::MD5.hexdigest(k_opad + digest)
end