The filesystem hashes also have another design criteria: they need to
reliably give the _same_ hash on different machines.
In particular, the suggested hash_mem() thing is endian-unsafe, meaning
that it will give different answers on an x86 than on a sparc CPU, for
example. Which can be ok if the only thing you care about is some
temporary hash, but is unacceptable for a lot of uses. The filesystem
hashes (well, at least some of them) are also designed to hash out files
on the disk, which means that they _have_ to be the same regardless of
architecture, or you can't move disks between machines.
Quite frankly, I think the suggested hash_mem() is too special-cased to
make any sense as a generic function. The endian problems means that it
_isn't_ really generic anyway, and as such it might as well just be some
internal nfs helper function rather than something in <linux/string.h>
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/