/usr/lib/ruby/vendor_ruby/net/ssh/transport/key_expander.rb is in ruby-net-ssh 1:3.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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]
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
|