# Why do hash functions use xor to combine multiple values?

**URL:** <https://discourse.julialang.org/t/why-do-hash-functions-use-xor-to-combine-multiple-values/109967>\
**Category:** General Usage\
**Tags:** hash\
**Created:** [February 9, 2024, 7:42am UTC](https://discourse.julialang.org/t/why-do-hash-functions-use-xor-to-combine-multiple-values/109967 "2024-02-09T07:42:45Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [February 9, 2024, 4:33pm UTC](https://discourse.julialang.org/t/why-do-hash-functions-use-xor-to-combine-multiple-values/109967/10 "2024-02-09T16:33:27Z")

</div>

The common idiom I see and like here is to also hash the type itself. E.g.,

> <https://github.com/JuliaLang/julia/blob/95233619745ef84c96af82299b162aa008a7debd/base/docs/utils.jl#L96-L96>

---

_[View the full topic](https://discourse.julialang.org/t/why-do-hash-functions-use-xor-to-combine-multiple-values/109967)._
