vendredi 1 janvier 2021

Deterministic random bytes for crypto

Is there a way to generate random bytes for crypto in Go deterministically, from a high-entropy seed?

I found crypto/rand, which is safe for crypto but not deterministic.

I found math/rand, which can be initialized with a seed, but is not safe for crypto.

I found x/crypto/chacha20, and I was wondering if it would be safe to use XORKeyStream with a src value of 1s. The seed would be the key and nonce, which could be generated with crypto/rand.




Aucun commentaire:

Enregistrer un commentaire