> For the complete documentation index, see [llms.txt](https://www.x509.wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.x509.wiki/cryptography/hashing-algorithms.md).

# Hashing Algorithms

A hashing algorithm is a mathematical function that converts input data of any size into a fixed-length string of characters, which is typically a sequence of letters and numbers. This output is known as a hash value or digest.

## What is a Collision? <a href="#what-is-a-collision" id="what-is-a-collision"></a>

A collision in hashing occurs when two distinct pieces of data produce the same hash value using a hashing algorithm12. This can be problematic because the primary goal of a hashing algorithm is to uniquely represent different data inputs.

## What is a MAC? <a href="#what-is-a-mac" id="what-is-a-mac"></a>

Message Authentication Code (MAC): In cryptography, a MAC is a short piece of information used to authenticate a message and ensure its integrity. It verifies that the message has not been altered and confirms the sender’s identity.

## How is a MAC different from an HMAC? <a href="#how-is-a-mac-different-than-an-hmac" id="how-is-a-mac-different-than-an-hmac"></a>

MAC: A general term for a code that verifies message integrity and authenticity, using either block ciphers or hash functions.

HMAC: A specific type of MAC that uses a cryptographic hash function and a secret key, offering stronger security properties.


---

# 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://www.x509.wiki/cryptography/hashing-algorithms.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.
