Exemplo n.º 1
0
        public void TestMethod1()
        {
            byte[] encryptByteArray = encryptor.Encrypt(Encoding.ASCII.GetBytes("=zasxi10021824 ajfd 22s"));
            string encryptStr       = Base32Object.GetEncodeStrResult(encryptByteArray);

            byte[] decryptByteArray = decryptor.Decrypt(encryptStr);
            string decryptStr       = Base32Object.GetDecodeStrResult(decryptByteArray);

            Assert.AreEqual("=zasxi10021824 ajfd 22s", decryptStr);
        }
Exemplo n.º 2
0
        public void Codec()
        {
            int inputLength = 20;
            int counter     = 1000000000;

            byte[] input = new byte[inputLength];

            for (int i = 0; i < counter; i++)
            {
                for (int j = 0; j < inputLength; j++)
                {
                    input[j] = Convert.ToByte(random.Next(0, 127));
                }

                string randomStr        = Encoding.ASCII.GetString(input);
                byte[] encryptByteArray = encryptor.Encrypt(input);
                string encryptStr       = Base32Object.GetEncodeStrResult(encryptByteArray);
                byte[] decryptByteArray = decryptor.Decrypt(encryptStr);
                string decryptStr       = Base32Object.GetDecodeStrResult(decryptByteArray);

                Assert.AreEqual(randomStr, decryptStr);
            }
        }