def update(username, password, algorithm = Algorithm::EXISTING)
      raise PasswdFileError, "Unable to update non-existent user #{username}" unless has_entry?(username)
      ir = internal_record(username)
      ir['entry'].algorithm = algorithm
      ir['entry'].password = password
      @lines[ir['line_index']] = ir['entry'].to_s
      dirty!
      return nil
    end
def update(username, password, algorithm = Algorithm::EXISTING)
      raise PasswdFileError, "Unable to update non-existent user #{username}" unless has_entry?(username)
      ir = internal_record(username)
      ir['entry'].algorithm = algorithm
      ir['entry'].password = password
      @lines[ir['line_index']] = ir['entry'].to_s
      dirty!
      return nil
    end
Public: Update an existing record in the file.

 By default, the same algorithm that already exists for the entry will be
 used with the new password. You may change the algorithm for an entry by
 setting the `algorithm` parameter.

 username  - the username of the entry
 password  - the username of the entry
 algorithm - the algorithm to use (default: "existing"). Valid options are:
             "existing", "md5", "sha1", "plaintext", or "crypt"

 Examples

   passwd_file.update("newuser", "password")
   passwd_file.save!

   passwd_file.update("newuser", "password", "sha1")
   passwd_file.save!

 Returns nothing.
 Raises PasswdFileError if the give username does not exist.