summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFlorian Wininger <fw.centrale@gmail.com>2019-08-23 22:12:14 +0200
committerFlorian Wininger <fw.centrale@gmail.com>2019-08-23 22:12:14 +0200
commit602ad9f91e876590aa43cc091728b699388ce011 (patch)
tree165bddfbb43d41c7252d90d6aa82be749bbeec9a /lib
parent084e38b1eafeb57d246a08132e2a0adef9920b5a (diff)
downloadnet-ssh-602ad9f91e876590aa43cc091728b699388ce011.tar.gz
Modernize OpenSSL SHA2 implementation
Signed-off-by: Florian Wininger <fw.centrale@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ssh/transport/hmac.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/net/ssh/transport/hmac.rb b/lib/net/ssh/transport/hmac.rb
index 3ba9349..d8560eb 100644
--- a/lib/net/ssh/transport/hmac.rb
+++ b/lib/net/ssh/transport/hmac.rb
@@ -15,21 +15,19 @@ require 'net/ssh/transport/hmac/none'
module Net::SSH::Transport::HMAC
# The mapping of SSH hmac algorithms to their implementations
MAP = {
- 'hmac-md5' => MD5,
- 'hmac-md5-96' => MD5_96,
- 'hmac-sha1' => SHA1,
- 'hmac-sha1-96' => SHA1_96,
- 'hmac-ripemd160' => RIPEMD160,
+ 'hmac-md5' => MD5,
+ 'hmac-md5-96' => MD5_96,
+ 'hmac-sha1' => SHA1,
+ 'hmac-sha1-96' => SHA1_96,
+ 'hmac-sha2-256' => SHA2_256,
+ 'hmac-sha2-256-96' => SHA2_256_96,
+ 'hmac-sha2-512' => SHA2_512,
+ 'hmac-sha2-512-96' => SHA2_512_96,
+ 'hmac-ripemd160' => RIPEMD160,
'hmac-ripemd160@openssh.com' => RIPEMD160,
'none' => None
}
- # add mapping to sha2 hmac algorithms if they're available
- MAP['hmac-sha2-256'] = SHA2_256 if defined?(::Net::SSH::Transport::HMAC::SHA2_256)
- MAP['hmac-sha2-256-96'] = SHA2_256_96 if defined?(::Net::SSH::Transport::HMAC::SHA2_256_96)
- MAP['hmac-sha2-512'] = SHA2_512 if defined?(::Net::SSH::Transport::HMAC::SHA2_512)
- MAP['hmac-sha2-512-96'] = SHA2_512_96 if defined?(::Net::SSH::Transport::HMAC::SHA2_512_96)
-
# Retrieves a new hmac instance of the given SSH type (+name+). If +key+ is
# given, the new instance will be initialized with that key.
def self.get(name, key="", parameters = {})