mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/openssl] hmac: add a test case for OpenSSL::HMAC singleton methods
https://github.com/ruby/openssl/commit/8253d7c9ce
This commit is contained in:
parent
fde9f806cb
commit
baea36c955
Notes:
git
2021-03-16 20:38:50 +09:00
1 changed files with 9 additions and 0 deletions
|
@ -49,6 +49,15 @@ class OpenSSL::TestHMAC < OpenSSL::TestCase
|
|||
refute_equal h1, h2.digest
|
||||
refute_equal h1, h3
|
||||
end
|
||||
|
||||
def test_singleton_methods
|
||||
# RFC 2202 2. Test Cases for HMAC-MD5
|
||||
key = ["0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"].pack("H*")
|
||||
digest = OpenSSL::HMAC.digest("MD5", key, "Hi There")
|
||||
assert_equal ["9294727a3638bb1c13f48ef8158bfc9d"].pack("H*"), digest
|
||||
hexdigest = OpenSSL::HMAC.hexdigest("MD5", key, "Hi There")
|
||||
assert_equal "9294727a3638bb1c13f48ef8158bfc9d", hexdigest
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue