예제 #1
0
        public void SerpentTest()
        {
            CipherKeyGenerator cipherKeyGenerator = new CipherKeyGenerator();

            cipherKeyGenerator.Init(new KeyGenerationParameters(new SecureRandom(), 128));
            byte[] key     = cipherKeyGenerator.GenerateKey();
            string message = "Hello World!";

            // Encrypt the string to an in-memory buffer.

            byte[] encrptedDAta = SerpentAlgo.SerpentEncryption(message, key);

            // Decrypt the buffer back to a string.
            string plainText = SerpentAlgo.SerpentDecryption(encrptedDAta, key);

            // Display the decrypted string to the console.

            Console.WriteLine(plainText);
        }
예제 #2
0
        public string Decrypt_Serpent(byte[] cypherData, byte[] key)
        {
            string plainText = SerpentAlgo.SerpentDecryption(cypherData, key);

            return(plainText);
        }