! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
SHA-256 instead of MD5 in icon cache, and always hashing the image data inste...
Status:
RESOLVED: MOVED
Product:
Xfce4-notifyd
Component:
general

Comments

Description Jan Ziak (http://atom-symbol.net) 2020-05-11 02:43:22 CEST
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.
Comment 1 Jan Ziak (http://atom-symbol.net) 2020-05-11 12:31:18 CEST
GLib's SHA-1 is faster than both of its MD5 and SHA-256 implementations.
Comment 2 Simon Steinbeiss editbugs 2020-05-14 00:48:53 CEST
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?
Comment 3 Jan Ziak (http://atom-symbol.net) 2020-05-14 01:29:10 CEST
Yes, SHA1 seems to be the best choice overall. I will try to submit a patch in a few days.
Comment 4 Jan Ziak (http://atom-symbol.net) 2020-05-20 16:34:05 CEST
Merge request (WIP): https://gitlab.xfce.org/apps/xfce4-notifyd/-/merge_requests/5
Comment 5 Git Bot editbugs 2020-05-24 20:08:38 CEST
-- 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

Bug #16825

Reported by:
Jan Ziak (http://atom-symbol.net)
Reported on: 2020-05-11
Last modified on: 2020-05-24

People

Assignee:
Simon Steinbeiss
CC List:
0 users

Version

Attachments

Additional information