# Blockchain cryptography

I'm a high school student doing a project about blockchain. I'm trying to figure out why hashing algorithms are crucial for the existence of blockchain and other types of cryptography wouldn't work. However I've learned about pseudo random number generators and they seem to do the job. Any reason why these would not be qualified?

• Generally, a PRF (like a hash) is $\{0,1\}^\ast\rightarrow\{0,1\}^n$, whereas a PRG is $\{0,1\}^n\rightarrow\{0,1\}^\ast$. Can you see how, while they could both be made to work, one of them seems better suited for the job? – forest Jan 23 at 7:01

One key difference between cryptographic hash functions and PRGs is this:

1. Pseudorandom generators (PRGs) are secret key algorithms. A PRG's user needs to provide it with some random input that must be kept secret from any adversary. If there is no such input or it's not secret, the adversary can predict the output.
2. Cryptographic hash functions are (usually) unkeyed algorithms. They are designed to work in certain scenarios where there is no secret information at all. It should be hard for example for an adversary to find any input that produces some known output (preimage resistance), or a second input that produces the same output as a known input (second preimage resistance).

If you can grasp this and its implications for your topic you will be well ahead. A key observation is that blockchain is a public ledger.

• Thank you for your comment. So with PRGs if the input is not secret, then you can predict the output. However, to me this doesn't make any difference because hash functions are the same in that way: if you know the input, you can also predict (compute) the output. – j. loper Nov 13 '18 at 22:04

More often than not PRNG's are built using hash function or hash function techniques. They are built to create a stream of random bits given relatively few bits of random input. They are not built to hash possibly large amounts of data to a constant size output.

The latter is required for signature generation, and signatures are a fundamental part of the blockchain technology. So the data is hashed and verified using an efficient hash function. Hash functions are generally more performant than PRNGs.

Furthermore hash functions are often used for the proof of work which is often required to mine cryptocurrency. For instance, BitCoin uses a double SHA-256 call to perform the proof of work. Miners however only return BitCoins, so the hash function is not directly accessible from the outside of hardware miners. Not all block chain technology relies on mining though (and for most cryptocurrency it is very much the question what they rely on in the first place).