Class Net::SSH::Transport::HMAC::Abstract
In: lib/net/ssh/transport/hmac/abstract.rb
lib/net/ssh/transport/hmac/abstract.rb
Parent: Object

The base class of all OpenSSL-based HMAC algorithm wrappers.

Methods

digest   digest   key=   key=   new   new  

Attributes

key  [R]  The key in use for this instance.
key  [R]  The key in use for this instance.

Public Class methods

[Source]

    # File lib/net/ssh/transport/hmac/abstract.rb, line 37
37:     def initialize(key=nil)
38:       self.key = key
39:     end

[Source]

    # File lib/net/ssh/transport/hmac/abstract.rb, line 37
37:     def initialize(key=nil)
38:       self.key = key
39:     end

Public Instance methods

Compute the HMAC digest for the given data string.

[Source]

    # File lib/net/ssh/transport/hmac/abstract.rb, line 48
48:     def digest(data)
49:       OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]
50:     end

Compute the HMAC digest for the given data string.

[Source]

    # File lib/net/ssh/transport/hmac/abstract.rb, line 48
48:     def digest(data)
49:       OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]
50:     end

Sets the key to the given value, truncating it so that it is the correct length.

[Source]

    # File lib/net/ssh/transport/hmac/abstract.rb, line 43
43:     def key=(value)
44:       @key = value ? value.to_s[0,key_length] : nil
45:     end

Sets the key to the given value, truncating it so that it is the correct length.

[Source]

    # File lib/net/ssh/transport/hmac/abstract.rb, line 43
43:     def key=(value)
44:       @key = value ? value.to_s[0,key_length] : nil
45:     end

[Validate]