SHA-256 instead of MD5 in icon cache, and always hashing the image data instead of the image path
@atomsymbol
Submitted by Jan Ziak Assigned to Simon Steinbeiß @ochosi
Description
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.
Version: git