public void Setup()
        {
            XorShift = new XorShift(true);
            Payload1 = XorShift.GetRandomBytes(1024);
            Payload2 = XorShift.GetRandomBytes(2048);
            Payload3 = XorShift.GetRandomBytes(4096);
            Payload4 = XorShift.GetRandomBytes(8192);

            HashKey = ArgonHash
                      .GetHashKeyAsync(Passphrase, Salt, KeySize)
                      .GetAwaiter()
                      .GetResult();
        }
Exemple #2
0
        public void Setup()
        {
            XorShift = new XorShift(true);
            Payload1 = XorShift.GetRandomBytes(1024);
            Payload2 = XorShift.GetRandomBytes(2048);
            Payload3 = XorShift.GetRandomBytes(4096);
            Payload4 = XorShift.GetRandomBytes(8192);

            HashProvider = new Argon2ID_HashingProvider();

            HashKey = HashProvider.GetHashKey(Passphrase, Salt, KeySize);

            EncryptionProvider = new BouncyAesGcmEncryptionProvider(HashKey);
            EncryptedPayload1  = EncryptionProvider.Encrypt(Payload1).ToArray();
            EncryptedPayload2  = EncryptionProvider.Encrypt(Payload2).ToArray();
            EncryptedPayload3  = EncryptionProvider.Encrypt(Payload3).ToArray();
            EncryptedPayload4  = EncryptionProvider.Encrypt(Payload4).ToArray();
        }
Exemple #3
0
        public static async Task Main()
        {
            XorShifter = new XorShift(true);

            // Create a fixed sized random payload.
            RandomPayload = Encoding.UTF8.GetString(XorShifter.GetRandomBytes(20));

            await SetupClientAsync()
            .ConfigureAwait(false);

            await Console.In.ReadLineAsync().ConfigureAwait(false);
        }
Exemple #4
0
        private async Task DataTask(AsyncClient client)
        {
            for (int i = 0; i < 1000; i++)
            {
                var letter = new TestMessage()
                {
                    index = i,
                    data  = _xorShifter.GetRandomBytes(5000),
                };
                await client.Peer.Send(1, letter).ConfigureAwait(false);

                await Task.Delay(_random.Next(1, 3) * 1000);
            }
        }
        public void Setup()
        {
            XorShift = new XorShift(true);
            Payload  = XorShift.GetRandomBytes(1024);

            HashProvider = new Argon2ID_HashingProvider();

            HashKey = HashProvider.GetHashKey(Passphrase, Salt, KeySize);

            EncryptionProvider           = new AesGcmEncryptionProvider(HashKey);
            RecyclableEncryptionProvider = new RecyclableAesGcmEncryptionProvider(HashKey);

            //RecyclableManager.ConfigureNewStaticManagerWithDefaults();

            EncryptedPayload = EncryptionProvider.Encrypt(Payload).ToArray();
        }