Methods

Class Index [+]

Quicksearch

Net::SSH::Transport::KeyExpander

Public Class Methods

expand_key(bytes, start, options={}) click to toggle source

Generate a key value in accordance with the SSH2 specification. (RFC4253 7.2. “Output from Key Exchange”)

    # File lib/net/ssh/transport/key_expander.rb, line 6
 6:   def self.expand_key(bytes, start, options={})
 7:     if bytes == 0
 8:       return ""
 9:     end
10: 
11:     k = start[0, bytes]
12: 
13:     digester = options[:digester] or raise 'No digester supplied'
14:     shared   = options[:shared] or raise 'No shared secret supplied'
15:     hash     = options[:hash] or raise 'No hash supplied'
16: 
17:     while k.length < bytes
18:       step = digester.digest(shared + hash + k)
19:       bytes_needed = bytes - k.length
20:       k << step[0, bytes_needed]
21:     end
22: 
23:     return k
24:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.