Junio C Hamano <gitster@xxxxxxxxx> writes: > karthik nayak <karthik.188@xxxxxxxxx> writes: > >> 2. Generally in hashing algorithms the XOR is used to ensure that the >> output distribution is uniform which reduces collisions. Here, as you >> noted, we're more finding values for sorting rather than hashing in the >> traditional sense. So why use an XOR? > > I am not Jonathan, but since the mixing-of-bits is done with XOR in > the original that Linus and I wrote, I think the question applies to > our version as well. We prefer not to lose entropy from input > bytes, so we do not want to use OR or AND, which tend to paint > everything with 1 or 0 as you mix in bits from more bytes. > Thanks for the answering. My reasoning at the start was more of my thoughts on why XOR could be used here and your explanation makes it clearer. > Anyway the question sounds like "generally when you take tests you > write with a pencil, but right now you are merely taking notes and > not taking any tests. why are you writing with a pencil?" There are > multiple occasions that a pencil is a great fit as writing equipment. I'd say my questions was more of "I know a pencil is used when taking tests because of XYZ reasons. On similar lines, why is a pencil used here?" :)
Attachment:
signature.asc
Description: PGP signature