Module: Net::SSH::Transport::HMAC
- Defined in:
- lib/net/ssh/transport/hmac.rb,
lib/net/ssh/transport/hmac/md5.rb,
lib/net/ssh/transport/hmac/none.rb,
lib/net/ssh/transport/hmac/sha1.rb,
lib/net/ssh/transport/hmac/md5_96.rb,
lib/net/ssh/transport/hmac/sha1_96.rb,
lib/net/ssh/transport/hmac/abstract.rb,
lib/net/ssh/transport/hmac/sha2_256.rb,
lib/net/ssh/transport/hmac/sha2_512.rb,
lib/net/ssh/transport/hmac/ripemd160.rb,
lib/net/ssh/transport/hmac/sha2_256_96.rb,
lib/net/ssh/transport/hmac/sha2_512_96.rb,
lib/net/ssh/transport/hmac/sha2_256_etm.rb,
lib/net/ssh/transport/hmac/sha2_512_etm.rb
Overview
Implements a simple factory interface for fetching hmac implementations, or for finding the key lengths for hmac implementations.s
Defined Under Namespace
Classes: Abstract, MD5, MD5_96, None, RIPEMD160, SHA1, SHA1_96, SHA2_256, SHA2_256_96, SHA2_256_Etm, SHA2_512, SHA2_512_96, SHA2_512_Etm
Constant Summary collapse
- MAP =
The mapping of SSH hmac algorithms to their implementations
{ '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, '[email protected]' => SHA2_256_Etm, '[email protected]' => SHA2_512_Etm, 'hmac-ripemd160' => RIPEMD160, '[email protected]' => RIPEMD160, 'none' => None }
Class Method Summary collapse
-
.get(name, key = "", parameters = {}) ⇒ Object
Retrieves a new hmac instance of the given SSH type (
name
). -
.key_length(name) ⇒ Object
Retrieves the key length for the hmac of the given SSH type (
name
).
Class Method Details
.get(name, key = "", parameters = {}) ⇒ Object
Retrieves a new hmac instance of the given SSH type (name
). If key
is given, the new instance will be initialized with that key.
37 38 39 40 |
# File 'lib/net/ssh/transport/hmac.rb', line 37 def self.get(name, key = "", parameters = {}) impl = MAP[name] or raise ArgumentError, "hmac not found: #{name.inspect}" impl.new(Net::SSH::Transport::KeyExpander.(impl.key_length, key, parameters)) end |
.key_length(name) ⇒ Object
Retrieves the key length for the hmac of the given SSH type (name
).
43 44 45 46 |
# File 'lib/net/ssh/transport/hmac.rb', line 43 def self.key_length(name) impl = MAP[name] or raise ArgumentError, "hmac not found: #{name.inspect}" impl.key_length end |