Hinaser / jscrypto

Crypto library for Node/ES6/Typescript/Browser.
MIT License
37 stars 6 forks source link

Is JsCrypto.word32Array.random() as cryptographically strong as crypto.randomBytes() for random generation? #11

Open SuvabBaral opened 2 years ago

SuvabBaral commented 2 years ago

Is JsCrypto.Word32Array.random(8) same as crypto.randomBytes(8).toString("hex") in terms of cryptographically strong random generation?

Hinaser commented 2 years ago

It depends on implementation of crypto.randomBytes. Your question is the same as: Is crypto.randomBytes(8) the same as repeating crypto.randomBytes(4) 2 times? Note: JsCrypto.Word32Array.random(8) is actually doing latter(repeating rng and concatenate the results).