Skip to content

Cooperative Cancellation in PasswordHash #5123

@huven

Description

@huven

This issue to check if a PR would be accepted that adds support to abort a key derivation operation. This is useful e.g. when the user aborts a request that needs a computationally expensive key.

This could be implemented by adding a set_stop_token(std::stop_token) to PasswordHash. A sub-class can check the token at well-chosen intervals. If stop requested, the derivation can throw a cancellation exception to signal that the operation was aborted.

Would something along these lines be a valuable addition, or too specific to my use-case?

As C++20 is already required this should not introduce a new dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions