SteamKit2.CryptoHelper.GenerateRandomBlock C# (CSharp) Method

GenerateRandomBlock() public static method

Generate an array of random bytes given the input length
public static GenerateRandomBlock ( int size ) : byte[]
size int
return byte[]
        public static byte[] GenerateRandomBlock( int size )
        {
            using ( var rng = new RNGCryptoServiceProvider() )
            {
                byte[] block = new byte[ size ];

                rng.GetBytes( block );

                return block;
            }
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CDNClient"/> class without an application ticket.
        /// </summary>
        /// <param name="cdnServer">The CDN server to connect to.</param>
        /// <param name="steamID">The SteamID of the current user.</param>
        /// <param name="depotID">Depot ID being requested.</param>
        public CDNClient(ClientEndPoint cdnServer, uint depotID, SteamID steamID)
        {
            sessionKey = CryptoHelper.GenerateRandomBlock(32);

            webClient = new WebClient();

            endPoint     = cdnServer;
            appTicket    = null;
            this.steamID = steamID;
            this.depotID = depotID;
        }
All Usage Examples Of SteamKit2.CryptoHelper::GenerateRandomBlock