> For the complete documentation index, see [llms.txt](https://alham-rizvi.gitbook.io/alhamrizvi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alham-rizvi.gitbook.io/alhamrizvi/cryptography/hashing/15.-murmurhash.md).

# 13\_murmurhash.md — MurmurHash

***

## 1. What MurmurHash Is

MurmurHash is a **non-cryptographic hash function** designed for:

* speed
* uniform distribution

It is commonly used in:

* hash tables
* databases
* distributed systems

***

## 2. Key Characteristics

* Very fast
* Deterministic
* Not cryptographically secure
* Good distribution (low collisions in normal use)

***

## 3. Variants

Common versions:

| Version     | Notes            |
| ----------- | ---------------- |
| MurmurHash2 | Older version    |
| MurmurHash3 | Most widely used |

***

## 4. Example

```
Input  → hello  
MurmurHash3 → 613153351  (example integer output)
```

Unlike SHA, output is often:

* integer
* not always hex string

***

## 5. How It Works (Simple Idea)

MurmurHash uses:

* multiplication
* XOR operations
* bit rotations

***

### High-level flow:

1. Split input into blocks
2. Mix each block with constants
3. Combine using XOR and rotation
4. Finalize hash

***

## 6. Why It Is Fast

* Uses simple CPU operations
* No heavy cryptographic structure
* Optimized for performance

***

## 7. Why It Is NOT Secure

### 1. No collision resistance

Attackers can easily find:

```
m1 ≠ m2 but hash(m1) = hash(m2)
```

***

### 2. Predictable structure

Given input/output patterns:

* easier to reverse or manipulate

***

### 3. No cryptographic guarantees

* not one-way
* not resistant to attacks

***

## 8. Practical Usage

MurmurHash is used in:

* hash maps
* database indexing
* Bloom filters
* caching systems
* load balancing

***

## 9. Tools and Code

### Python (via library)

```python
import mmh3

print(mmh3.hash("hello"))
```

***

### Install library

```bash
pip install mmh3
```

***

## 10. CTF Mindset

When you see MurmurHash:

* Assume it is weak
* Do NOT treat it like SHA

***

### Try:

* reversing logic
* brute force (small inputs)
* collision crafting
* exploiting predictable behavior

***

## 11. MurmurHash vs Cryptographic Hash

| Feature              | MurmurHash      | SHA-256      |
| -------------------- | --------------- | ------------ |
| Purpose              | Speed           | Security     |
| Collision resistance | Weak            | Strong       |
| Reversible           | Sometimes       | No           |
| Use case             | Data structures | Cryptography |

***

## 12. Real-World Status

MurmurHash is:

* Widely used in systems
* Trusted for performance
* Not used for security

***

## 13. Final Summary

MurmurHash is:

* Fast
* Efficient
* Non-cryptographic
* Unsafe for security use

***

### Core Idea

MurmurHash shows that:

> some hash functions are designed for performance, not security — and using them in security contexts leads to vulnerabilities.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://alham-rizvi.gitbook.io/alhamrizvi/cryptography/hashing/15.-murmurhash.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
