Skip to content

Make comparison results deterministic in the UI#1654

Merged
qarmin merged 3 commits into
qarmin:masterfrom
RReverser:indexmap
Oct 20, 2025
Merged

Make comparison results deterministic in the UI#1654
qarmin merged 3 commits into
qarmin:masterfrom
RReverser:indexmap

Conversation

@RReverser
Copy link
Copy Markdown
Contributor

Demo (left is release version, right is the one built from this branch):

screen-capture.mp4

Fixes #1652.

The issue was that the code uses the standard HashMap in a lot of places, which infamously has randomised iteration order as a protection from DoS attacks on servers.

These concerns don't apply to local apps, and the randomisation leaks into comparisons and the UI.

To fix it, I've switched all the usages of HashMap and HashSet in czkawka_core to the indexmap crate, which is intended exactly for this kind of scenarios - when you want the performance of the HashMap, but care about deterministic iteration.

@RReverser
Copy link
Copy Markdown
Contributor Author

The remaining CI issues seem unrelated to my PR.

@qarmin qarmin merged commit 85f3273 into qarmin:master Oct 20, 2025
11 of 14 checks passed
@RReverser RReverser deleted the indexmap branch October 20, 2025 20:36
SpeedyGX pushed a commit to SpeedyGX/czkawka that referenced this pull request Apr 29, 2026
* IndexMap

* Put back std::fs but only for unix

* Revert change in localizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Similar images results are non-deterministic

2 participants