<p>The Cardano code does not use SHA256 or SHA512, but rather uses 2 different versions of the Blake2 hash functions (but Plutus may use SHA hashes).</p>
<p>Hash functions are used in several places. Two simple examples are block ids (ie the hash of the block) and transaction ids (the hash of the transaction). For these two examples reversing the hash is never needed.</p>
<p>I am almost certain that the Plutus &quot;unhashing&quot; function you see is just the accessor for the <code>newtype</code> wrapper (its a Haskell/Plutus thing).</p>

CC BY-SA 4.0
2022-07-15T09:16:11.760Z
2022-07-26T03:19:46.657Z
2022-07-26T03:19:46.657Z
Erik de Castro Lopo
<p>Hash functions are often called one way functions however this means that you should not be able to undo them. So why and how are SHA256 and SHA512 used in blockchains if they should be irreversible.</p>
<p>Also I noticed that Plutus has some unhasing functions how do these work?</p>

CC BY-SA 4.0
2022-07-15T09:45:38.187Z
The hash function in plutus is also a one-way function. I think that the `unHash` function that is meant here is the type constructor of a Hash type. `unHash` serves here to unwrap the type to, probably, a `builtinByteString`. Can you point to this `unHash` function?
Fermat
<plutus><hash><encryption>
How Does the Blockchain Use Hashes?
# How Does the Blockchain Use Hashes?

(Asked by: username_0 on 2022-07-15)

Hash functions are often called one way functions however this means that you should not be able to undo them. So why and how are SHA256 and SHA512 used in blockchains if they should be irreversible.

Also I noticed that Plutus has some unhasing functions how do these work?

**Tags:** plutus, hash, encryption
> **Comments:**
> **username_1**: The hash function in plutus is also a one-way function. I think that the `unHash` function that is meant here is the type constructor of a Hash type. `unHash` serves here to unwrap the type to, probably, a `builtinByteString`. Can you point to this `unHash` function?  

---

## 1 answers

### Answer by username_2 on 2022-07-15. Score: 2 | Accepted answer

The Cardano code does not use SHA256 or SHA512, but rather uses 2 different versions of the Blake2 hash functions (but Plutus may use SHA hashes).

Hash functions are used in several places. Two simple examples are block ids (ie the hash of the block) and transaction ids (the hash of the transaction). For these two examples reversing the hash is never needed.

I am almost certain that the Plutus "unhashing" function you see is just the accessor for the `newtype` wrapper (its a Haskell/Plutus thing).


---

