SHA-256 is the fastest strong hashing function because it is supported in hardware on modern CPUs. In OpenSSL 1.1.1 its performance is about 1.9 GB/s on a single Zen-2 core while MD5 is about 0.8 GB/s (1024 bytes block size). However, the performance of GLib's g_compute_checksum_for_bytes(G_CHECKSUM_SHA256) used by xfce4-notifyd differs from OpenSSL's performance. G_CHECKSUM_SHA256 is 2 times slower than G_CHECKSUM_MD5, and 6 times slower than OpenSSL SHA-256. CPU: Ryzen 3000. Secondly, because xfce4-notifyd is hashing the icon's path, instead of the icon's image data, the cache directory $HOME/.cache/xfce4/notifyd/icons ends up containing many duplicate images. In order to remove these duplicates xfce4-notifyd should always hash image data.
GLib's SHA-1 is faster than both of its MD5 and SHA-256 implementations.
Sorry, the title of this report and the first comment is a bit ambiguous. Let me summarize: you are proposing we switch to SHA1 instead of MD5, which we currently use? (you first mentioned SHA256) The latter (hashing the image data) definitely makes sense. Should be fairly straightforward - wanna work on a patch for this?
Yes, SHA1 seems to be the best choice overall. I will try to submit a patch in a few days.
Merge request (WIP): https://gitlab.xfce.org/apps/xfce4-notifyd/-/merge_requests/5
-- GitLab Migration Automatic Message -- This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/xfce4-notifyd/-/issues/31. Please create an account or use an existing account on one of our supported OAuth providers. If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev