brent timothy saner via plug on 25 Sep 2022 01:29:33 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] free courses, systemd Win, hashquines |
On 9/24/22 16:30, Walt Mankowski via plug wrote:
On Sat, Sep 24, 2022 at 02:30:46PM -0400, brent saner via plug wrote:MD5 is well and truly broken. It shouldn't be trusted for anything except transmission integrity checking, and even then there are significantly better alternatives.I don't trust MD5 for external files, but I still run md5sum on directories to check for duplicate files, mainly because it's a lot faster than sha1sum. Are there alternatives you recommend? ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
If you have *total control* over the directory/directories, that's still a valid use case for MD5, IMHO.
But! If you have the *option*, I'd highly recommend BLAKE2[0]. (There is a BLAKE3, which is even faster, but support/implementation/availability is far from prevalent.)
Like MD5 (and a handful of others), it has its own RFC.[1]There are two basic variants, BLAKE2s and BLAKE2b. You likely want BLAKE2b, where given the choice; BLAKE2s is moreso for 32-bit machines.
It's faster* than MD5 for checksumming (what you'd usually use it for anyways these days) with the benefit of being "as strong" as the SHA-3 suite for integrity. It uses ChaCha under the hood, which - to my knowledge - has no vulns (but CAN be extremely tricky to *use* without any vulns if the spec isn't followed exactly).
Mini-Rosetta for you: (SH) md5sum => b2sum (part of coreutils; it's likely already installed)(Perl) Digest::MD5 => https://metacpan.org/pod/Digest::BLAKE2 (and likely others; I'd imagine there's a pure Perl implementation)
(Python) hashlib.md5() (unless FIPS) => hashlib.blake2b()/hashlib.blake2s()(Golang) crypto/md5 => golang.org/x/crypto/blake2b, golang.org/x/crypto/blake2s
(Rust) md5 => blake2 HTH* Basic benchmarks show it roughly 2.5% faster than MD5 for BLAKE2s, and a quite impressive ~33% faster than MD5 for BLAKE2b.
[0] https://www.blake2.net/ [1] https://www.rfc-editor.org/rfc/rfc7693 ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug