1

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?

1
  • 2
    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
    Commented Jul 15, 2022 at 9:45

2 Answers 2

2

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).

1

Cardano does not use SHA256 hashing. There are BLAKE2b cryptographic hashing algorithms in Cardano, and the following table represents three of them:


Hashing Algorithm Referred as Used for
BLAKE2b-224 hash28 Verification keys and multi-signature scripts
BLAKE2b-256 hash32 Used everywhere else in Cardano
BLAKE2b-512 hash64 Used for key derivations

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.