def auth_password_equal?(input_pw, is_localized=false)
      input_pw = input_pw.to_s unless input_pw.is_a?(String)
      # If we provide no password, and no password present, it's a match!
      return true if input_pw.empty? && auth_protocol == :none
      # If we provide no password, but a password is present, or vice versa...
      return false if input_pw.empty? || auth_protocol == :none
      # OK, we have an input password, and a password is configured
      current_pw = auth_password
      if current_pw.nil?
        fail "SNMP user #{@name} #{@engine_id} has auth #{auth_protocol} " \
             "but no password?\n" + @@node.get(command: 'show run snmp all')
      end

      if is_localized
        # In this case, the password is already hashed.
        hashed_pw = input_pw
      else
        # In this case passed in password is clear text while the running
        # config is hashed value. We need to hash the passed in clear text.

        # Create dummy user
        config_set('snmp_user', 'user', '', 'dummy_user', '',
                   "auth #{_auth_sym_to_str(auth_protocol)} #{input_pw}",
                   '', '',
                   @engine_id.empty? ? '' : "engineID #{@engine_id}")

        # Retrieve password hashes
        hashed_pw = SnmpUser.auth_password('dummy_user', @engine_id)
        if hashed_pw.nil?
          fail "SNMP dummy user dummy_user #{@engine_id} was configured " \
               "but password is missing?\n" \
               + @@node.get(command: 'show run snmp all')
        end

        # Delete dummy user
        config_set('snmp_user', 'user', 'no', 'dummy_user', '',
                   "auth #{_auth_sym_to_str(auth_protocol)} #{hashed_pw}",
                   '', 'localizedkey',
                   @engine_id.empty? ? '' : "engineID #{@engine_id}")
      end
      hashed_pw == current_pw
    end
def auth_password_equal?(input_pw, is_localized=false)
      input_pw = input_pw.to_s unless input_pw.is_a?(String)
      # If we provide no password, and no password present, it's a match!
      return true if input_pw.empty? && auth_protocol == :none
      # If we provide no password, but a password is present, or vice versa...
      return false if input_pw.empty? || auth_protocol == :none
      # OK, we have an input password, and a password is configured
      current_pw = auth_password
      if current_pw.nil?
        fail "SNMP user #{@name} #{@engine_id} has auth #{auth_protocol} " \
             "but no password?\n" + @@node.get(command: 'show run snmp all')
      end

      if is_localized
        # In this case, the password is already hashed.
        hashed_pw = input_pw
      else
        # In this case passed in password is clear text while the running
        # config is hashed value. We need to hash the passed in clear text.

        # Create dummy user
        config_set('snmp_user', 'user', '', 'dummy_user', '',
                   "auth #{_auth_sym_to_str(auth_protocol)} #{input_pw}",
                   '', '',
                   @engine_id.empty? ? '' : "engineID #{@engine_id}")

        # Retrieve password hashes
        hashed_pw = SnmpUser.auth_password('dummy_user', @engine_id)
        if hashed_pw.nil?
          fail "SNMP dummy user dummy_user #{@engine_id} was configured " \
               "but password is missing?\n" \
               + @@node.get(command: 'show run snmp all')
        end

        # Delete dummy user
        config_set('snmp_user', 'user', 'no', 'dummy_user', '',
                   "auth #{_auth_sym_to_str(auth_protocol)} #{hashed_pw}",
                   '', 'localizedkey',
                   @engine_id.empty? ? '' : "engineID #{@engine_id}")
      end
      hashed_pw == current_pw
    end
Passwords are hashed and so cannot be retrieved directly, but can be
 checked for equality. This is done by creating a fake user with the
 password and then comparing the hashes