dimanche 20 février 2022

How can Deterministic Pseudo Randm Number Generator generate 64 byte hash from 32 byte seed using SHA-256 hashing function?

SHA-256 hashing function outputs 32 byte hash always. How can I, using 32 byte seed and SHA-256 hashing function to create an 64 byte hash output ?

I've heard that they use technique like this (pseudocode):

init_hash = SHA256 (seed)
next_hash = SHA256 (init_hash + 1)
next_hash_vol2 = SHA256 (next_hash + 2)
next_hash_vol3 = SHA256 (next_hash_vol2 + 3)
...
next_hash_volA = SHA256 (next_hash_vol9 + A)
...
next_hash_vol10 = SHA256 (next_hash_volF + 10)
...
...
next_hash_vol64 = SHA256 (next_hash_vol63 + 40)

This sounds really nice! But problem is that SHA-256 ALWAYS generates 32 byte output, but I need 64 bytes :(




Aucun commentaire:

Enregistrer un commentaire