]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sort(1): randomcoll: Skip the memory allocation entirely
authorcem <cem@FreeBSD.org>
Thu, 4 Apr 2019 23:32:27 +0000 (23:32 +0000)
committercem <cem@FreeBSD.org>
Thu, 4 Apr 2019 23:32:27 +0000 (23:32 +0000)
commit0ebf68b84ef9bc1fc531ebc49e19394ccef2d9d4
tree2e88390777de5a4e55c0e4ead9a72cb4a40777ba
parent185da79fc0d5b852e1b7fe83e6546f6c14c78595
sort(1): randomcoll: Skip the memory allocation entirely

There's no reason to order based on strcmp of ASCII digests instead of
memcmp of the raw digests.

While here, remove collision fallback.  If you collide two MD5s, they're
probably the same string anyway.  If robustness against MD5 collisions is
desired, maybe we shouldn't use MD5.

None of the behavior of sort -R is specified by POSIX, so we're free to
implement this however we like.  E.g., using a 128-bit counter and block cipher
to generate unique indices for each line of input.

PR: 230792 (2/many)
Relnotes: This will change the sort order for a given dataset with a
given seed.  Other similarly breaking changes are planned.
Sponsored by: Dell EMC Isilon
usr.bin/sort/coll.c