Crypto Utility
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Security.Cryptography; public static class CryptoUtility { public static byte[] GetRandomBytes(int size) { byte[] randomBytes = new byte[size]; GetRandomBytes(randomBytes); return randomBytes; } public static void GetRandomBytes(byte[] bytes) { RNGCryptoServiceProvider.Create().GetBytes(bytes); } public static byte[] CombineBytes(byte[] buffer1, byte[] buffer2) { byte[] combinedBytes = new byte[buffer1.Length + buffer2.Length]; Buffer.BlockCopy(buffer1, 0, combinedBytes, 0, buffer1.Length); Buffer.BlockCopy(buffer2, 0, combinedBytes, buffer1.Length, buffer2.Length); return combinedBytes; } }