lundi 7 octobre 2019

Why does .NET's RandomNumberGenerator.GetBytes method assign its results to a byte array parameter instead of returning a new byte array?

The .NET Framework has the RandomNumberGenerator class for generating cryptographically-secure random bytes. One of its main methods, GetBytes, has the signature void GetBytes (byte[] data) - it takes a byte array as a parameter and fills it with random bytes, rather than returning a byte array. Why is this? Are there security reasons for operating on an existing array instead of creating a new one?




Aucun commentaire:

Enregistrer un commentaire