> For the complete documentation index, see [llms.txt](https://hub.bsvblockchain.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-primitives-hash-functions/what-are-hash-functions/the-differences-between-hashing-and-encryption.md).

# The Differences Between Hashing and Encryption

Since **hash functions** are a type of **cryptographic primitive** (building blocks used in security systems), they are often confused with **encryption**. But the two serve **different purposes**.

Here are the three key differences:

***

#### 1. Data Preservation vs. Data Loss

* **Hashing:** Produces a **fixed-length output** in clear text. It acts as a **digital fingerprint** of the input, and **data loss is not a concern**.
* **Encryption:** Encodes and **preserves the entire message**, so it can later be **decrypted** back into its original form.

👉 **Key takeaway:** Hashing is about **verification**, encryption is about **confidentiality**.

***

#### 2. Reversibility

* **Hashing:** A **one-way function**. It is **not reversible** — and that’s what makes it secure.
* **Encryption:** Must be **reversible**. The intended recipient needs to **decrypt** the message to read it.

👉 **Key takeaway:** Hashes stay one-way, encrypted data must come back.

***

#### 3. Collision Risk

* **Hashing:** Because outputs are **fixed length**, two different inputs can, in theory, produce the **same hash** — this is called a **collision**.
  * In practice, BSV uses **SHA-256** and **RIPEMD-160**, which make collisions **extremely rare** (probabilistically insignificant).
* **Encryption:** Since it **preserves 100% of the input**, each encrypted message produces a **unique output** — meaning **no collision risk**.

👉 **Key takeaway:** Hashes can collide (though rarely), encrypted data cannot.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hub.bsvblockchain.org/higher-learning/bsv-academy/bitcoin-primitives-hash-functions/what-are-hash-functions/the-differences-between-hashing-and-encryption.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
