You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I need to generate some random data for a string, I'd run code like this:
if let randomBytes = try? Random.generate(byteCount: 64) {
randomString = CryptoUtils.hexString(from: randomBytes)
} else {
randomString = generateMyOwnRandomStringSomehow()
}
If I'm trying to generate something important, e.g. a salt, the generateMyOwnRandomStringSomehow() is a weak point because it relies on users to have some idea of PRNG techniques. Is it possible to make Random.generate() always return a value, perhaps by implementing a second generation algorithm that can be used if the preferred algorithm fails?
(Note: the answer may well be "No", but I'm following the "if you don't ask, you don't get" approach.")
The text was updated successfully, but these errors were encountered:
When I need to generate some random data for a string, I'd run code like this:
If I'm trying to generate something important, e.g. a salt, the
generateMyOwnRandomStringSomehow()
is a weak point because it relies on users to have some idea of PRNG techniques. Is it possible to make Random.generate() always return a value, perhaps by implementing a second generation algorithm that can be used if the preferred algorithm fails?(Note: the answer may well be "No", but I'm following the "if you don't ask, you don't get" approach.")
The text was updated successfully, but these errors were encountered: