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
The Random.generate(byteCount:) is a useful way of generating random bytes, but in my own work I found I was mostly using it to generate random strings for encryption purposes. This meant every call to Random.generate(byteCount:) was followed by a call to CryptoUtils.hexString(from:) to get a Swift string rather than just bytes.
If you could implement a Random.generate(hexCharacterCount:) method that combined the two together, it would be most appreciated. If this were combined with #17, then this code:
if let randomBytes = try? Random.generate(byteCount: 64) {
randomString = CryptoUtils.hexString(from: randomBytes)
} else {
randomString = generateMyOwnRandomStringSomehow()
}
The
Random.generate(byteCount:)
is a useful way of generating random bytes, but in my own work I found I was mostly using it to generate random strings for encryption purposes. This meant every call toRandom.generate(byteCount:)
was followed by a call toCryptoUtils.hexString(from:)
to get a Swift string rather than just bytes.If you could implement a
Random.generate(hexCharacterCount:)
method that combined the two together, it would be most appreciated. If this were combined with #17, then this code:Would become simply this:
(Note: There may well be a better name for this method.)
The text was updated successfully, but these errors were encountered: