| Class | Net::SSH::Transport::HMAC::Abstract |
| In: |
lib/net/ssh/transport/hmac/abstract.rb
lib/net/ssh/transport/hmac/abstract.rb |
| Parent: | Object |
| key | [R] | The key in use for this instance. |
| key | [R] | The key in use for this instance. |
# File lib/net/ssh/transport/hmac/abstract.rb, line 33
33: def digest_class(*v)
34: @digest_class = nil if !defined?(@digest_class)
35: if v.empty?
36: @digest_class = superclass.digest_class if @digest_class.nil? && superclass.respond_to?(:digest_class)
37: return @digest_class
38: elsif v.length == 1
39: @digest_class = v.first
40: else
41: raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
42: end
43: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 33
33: def digest_class(*v)
34: @digest_class = nil if !defined?(@digest_class)
35: if v.empty?
36: @digest_class = superclass.digest_class if @digest_class.nil? && superclass.respond_to?(:digest_class)
37: return @digest_class
38: elsif v.length == 1
39: @digest_class = v.first
40: else
41: raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
42: end
43: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 9
9: def key_length(*v)
10: @key_length = nil if !defined?(@key_length)
11: if v.empty?
12: @key_length = superclass.key_length if @key_length.nil? && superclass.respond_to?(:key_length)
13: return @key_length
14: elsif v.length == 1
15: @key_length = v.first
16: else
17: raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
18: end
19: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 9
9: def key_length(*v)
10: @key_length = nil if !defined?(@key_length)
11: if v.empty?
12: @key_length = superclass.key_length if @key_length.nil? && superclass.respond_to?(:key_length)
13: return @key_length
14: elsif v.length == 1
15: @key_length = v.first
16: else
17: raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
18: end
19: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 21
21: def mac_length(*v)
22: @mac_length = nil if !defined?(@mac_length)
23: if v.empty?
24: @mac_length = superclass.mac_length if @mac_length.nil? && superclass.respond_to?(:mac_length)
25: return @mac_length
26: elsif v.length == 1
27: @mac_length = v.first
28: else
29: raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
30: end
31: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 21
21: def mac_length(*v)
22: @mac_length = nil if !defined?(@mac_length)
23: if v.empty?
24: @mac_length = superclass.mac_length if @mac_length.nil? && superclass.respond_to?(:mac_length)
25: return @mac_length
26: elsif v.length == 1
27: @mac_length = v.first
28: else
29: raise ArgumentError, "wrong number of arguments (#{v.length} for 1)"
30: end
31: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 61
61: def initialize(key=nil)
62: self.key = key
63: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 61
61: def initialize(key=nil)
62: self.key = key
63: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 54
54: def digest_class
55: self.class.digest_class
56: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 54
54: def digest_class
55: self.class.digest_class
56: end
Sets the key to the given value, truncating it so that it is the correct length.
# File lib/net/ssh/transport/hmac/abstract.rb, line 67
67: def key=(value)
68: @key = value ? value.to_s[0,key_length] : nil
69: end
Sets the key to the given value, truncating it so that it is the correct length.
# File lib/net/ssh/transport/hmac/abstract.rb, line 67
67: def key=(value)
68: @key = value ? value.to_s[0,key_length] : nil
69: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 46
46: def key_length
47: self.class.key_length
48: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 46
46: def key_length
47: self.class.key_length
48: end
# File lib/net/ssh/transport/hmac/abstract.rb, line 50
50: def mac_length
51: self.class.mac_length
52: end