Sha256: ff3efad859dc4f1565c01f153fde38216a012651bd5eb4e9095ba556e9e60515

Contents?: true

Size: 715 Bytes

Versions: 37

Compression:

Stored size: 715 Bytes

Contents

module Net; module SSH; module Transport
  module KeyExpander

  # Generate a key value in accordance with the SSH2 specification.
  # (RFC4253 7.2. "Output from Key Exchange")
  def self.expand_key(bytes, start, options={})
    if bytes == 0
      return ""
    end

    k = start[0, bytes]
    return k if k.length >= bytes

    digester = options[:digester] or raise 'No digester supplied'
    shared   = options[:shared] or raise 'No shared secret supplied'
    hash     = options[:hash] or raise 'No hash supplied'

    while k.length < bytes
      step = digester.digest(shared + hash + k)
      bytes_needed = bytes - k.length
      k << step[0, bytes_needed]
    end

    return k
  end
  end
end; end; end

Version data entries

37 entries across 34 versions & 3 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
net-ssh-5.0.0.beta1 lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
net-ssh-4.2.0 lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
net-ssh-4.2.0.rc2 lib/net/ssh/transport/key_expander.rb
net-ssh-4.2.0.rc1 lib/net/ssh/transport/key_expander.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/key_expander.rb
net-ssh-4.1.0 lib/net/ssh/transport/key_expander.rb