Sha256: c9260e5932e0e25eb14024b2e1b970e4506cb03eebf72366fccf806f15b3d0b9

Contents?: true

Size: 1.04 KB

Versions: 152

Compression:

Stored size: 1.04 KB

Contents

require 'net/ssh/transport/hmac/md5'
require 'net/ssh/transport/hmac/md5_96'
require 'net/ssh/transport/hmac/sha1'
require 'net/ssh/transport/hmac/sha1_96'
require 'net/ssh/transport/hmac/none'

# Implements a simple factory interface for fetching hmac implementations, or
# for finding the key lengths for hmac implementations.s
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,
    'none'         => None
  }

  # 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="")
    impl = MAP[name] or raise ArgumentError, "hmac not found: #{name.inspect}"
    impl.new(key)
  end

  # Retrieves the key length for the hmac of the given SSH type (+name+).
  def self.key_length(name)
    impl = MAP[name] or raise ArgumentError, "hmac not found: #{name.inspect}"
    impl.key_length
  end
end

Version data entries

152 entries across 122 versions & 14 rubygems

Version Path
tpkg-2.3.5 lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac.rb
tpkg-2.3.4 lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.10 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.11 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.12 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.13 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.14 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.15 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.16 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.17 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.5 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.6 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.7 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
auser-poolparty-1.3.8 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
ddollar-net-ssh-2.0.1 lib/net/ssh/transport/hmac.rb
fairchild-poolparty-1.3.17 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
fairchild-poolparty-1.3.5 vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb
jayniz-net-ssh-2.0.15 lib/net/ssh/transport/hmac.rb
kjvarga-net-ssh-2.0.12 lib/net/ssh/transport/hmac.rb
net-ssh-net-ssh-2.0.12 lib/net/ssh/transport/hmac.rb