# 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: 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:

```
GET https://www.x509.wiki/cryptography/hashing-algorithms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
