Beispiel #1
0
        private static string Decrypt(String name)
        {
            int[]  cipher         = new[] { 1, 1, 2, 3, 5, 8, 13 };                     //Fibonacci Sequence
            string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display

            int encryptionDepth = 20;

            Encrypter encrypter = new Encrypter(name, cipher, encryptionDepth);

            //Single Level Encrytion
            string nameEncryptWithCipher = Encrypter.EncryptWithCipher(name, cipher);


            string nameDecryptWithCipher = Encrypter.DecryptWithCipher(nameEncryptWithCipher, cipher);

            Console.WriteLine($"Decrypted once using the cipher {{{cipherasString}}} {nameDecryptWithCipher}");

            //Deep Encrytion
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(name, cipher, encryptionDepth);


            string nameDeepDecryptWithCipher = Encrypter.DeepDecryptWithCipher(nameDeepEncryptWithCipher, cipher, encryptionDepth);

            Console.WriteLine($"Deep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}");



            string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64);

            Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}");

            return(nameDeepDecryptWithCipher);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int[] cipher = new[] { 1, 1, 2, 3, 5, 8, 13 };



            Console.WriteLine("Please enter your text");
            var fullName = Console.ReadLine();

            Console.WriteLine("Your entered text is: " + fullName);

            BinaryConverter binaryConverter = new BinaryConverter();
            string          binaryValue     = binaryConverter.ConvertTo(fullName);

            Console.WriteLine($"{fullName} as Binary: {binaryValue}");
            Console.WriteLine("Converting value from Binary to ASCII :");
            Console.WriteLine($"Binary Value:{binaryValue}" + "\n" +
                              $"The text converted from Binary to text: {binaryConverter.ConvertBinaryToString(binaryValue)}");

            HexadecimalConverter hex = new HexadecimalConverter();
            string StringToHex       = hex.ConvertTo(fullName);

            Console.WriteLine($"{fullName} as Hexadecimal Value is : {StringToHex}");
            Console.WriteLine($"{StringToHex} is Hexadecimal for ASCII: {hex.ConveryFromHexToASCII(StringToHex)}");

            string nameBase64Encoded = Models.Base64.StringToBase64(fullName);

            Console.WriteLine("The text converted to the Base64 is :" + nameBase64Encoded);

            string nameBase64Decoded = Models.Base64.Base64ToString(nameBase64Encoded);

            Console.WriteLine($"The Text value of {nameBase64Encoded} is :" + nameBase64Decoded);

            Console.WriteLine("for the conversion of the fullname to bytearray:");
            byte[] fullnamebytes = Encoding.ASCII.GetBytes(fullName);
            foreach (byte b in fullnamebytes)
            {
                Console.WriteLine("Converted text in the byte[]: " + b);
            }


            Console.WriteLine("Please Enter the Text That need to be DeepEncrypt ");

            string unicodeString = Console.ReadLine();

            int       encryptionDepth = 10;
            string    cipherasString  = String.Join(",", cipher.Select(x => x.ToString()));
            Encrypter encrypter       = new Encrypter(unicodeString, cipher, encryptionDepth);


            string nameEncryptWithCipher = Encrypter.EncryptWithCipher(unicodeString, cipher);

            Console.WriteLine($"Encrypted once using the cipher {{{cipherasString}}} {nameEncryptWithCipher}");

            string nameDecryptWithCipher = Encrypter.DecryptWithCipher(nameEncryptWithCipher, cipher);

            Console.WriteLine($"Decrypted once using the cipher {{{cipherasString}}} {nameDecryptWithCipher}");
        }
Beispiel #3
0
        private static void AllInONeConvertor(String name)
        {
            BinaryConverter binaryConverter = new BinaryConverter();
            string          binaryValue     = binaryConverter.ConvertTo(name);

            Console.WriteLine($"{name} as Binary: {binaryValue}");
            Console.WriteLine($"{name} from Binary to ASCII: {binaryConverter.ConvertBinaryToString(binaryValue)}");

            HexadecimalConverter hexadecimalConverter = new HexadecimalConverter();
            string hexadecimalValue = hexadecimalConverter.ConvertTo(name);

            Console.WriteLine($"{name} as Hexadecimal: {hexadecimalValue}");
            Console.WriteLine($"{name} from Hexadecimal to ASCII: {hexadecimalConverter.ConveryFromHexToASCII(hexadecimalValue)}");

            Base64Convertor base64Converter = new Base64Convertor();
            string          base64Value     = base64Converter.StringToBase64(name);

            Console.WriteLine($"{name} as Base64: {base64Value}");
            Console.WriteLine($"{name} from base64 to ASCII: {base64Converter.Base64ToString(base64Value)}");

            int[]  cipher         = new[] { 1, 1, 2, 3, 5, 8, 13 };                     //Fibonacci Sequence
            string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display

            int encryptionDepth = 20;

            Encrypter encrypter = new Encrypter(name, cipher, encryptionDepth);

            //Single Level Encrytion
            string nameEncryptWithCipher = Encrypter.EncryptWithCipher(name, cipher);

            Console.WriteLine($"Encrypted once using the cipher {{{cipherasString}}} {nameEncryptWithCipher}");

            string nameDecryptWithCipher = Encrypter.DecryptWithCipher(nameEncryptWithCipher, cipher);

            Console.WriteLine($"Decrypted once using the cipher {{{cipherasString}}} {nameDecryptWithCipher}");

            //Deep Encrytion
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(name, cipher, encryptionDepth);

            Console.WriteLine($"Deep Encrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepEncryptWithCipher}");

            string nameDeepDecryptWithCipher = Encrypter.DeepDecryptWithCipher(nameDeepEncryptWithCipher, cipher, encryptionDepth);

            Console.WriteLine($"Deep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}");

            //Base64 Encoded
            Console.WriteLine($"Base64 encoded {name} {encrypter.Base64}");

            string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64);

            Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}");
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Enter your full name: ");
            string name = Console.ReadLine();

            int[]  cipher         = new[] { 1, 1, 2, 3, 5, 8, 13 };                     //Fibonacci Sequence
            string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display

            int encryptionDepth = 20;

            //binary conversion
            BinaryConverter binaryConverter = new BinaryConverter();
            string          binaryValue     = binaryConverter.ConvertTo(name);

            Console.WriteLine($"{name} as Binary: {binaryValue}");
            Console.WriteLine("Enter Binary Version of your Name: ");
            string binaryName = Console.ReadLine();

            Console.WriteLine($"{binaryName} from Binary to ASCII: {binaryConverter.ConvertBinaryToString(binaryValue)}");

            //hex conversion
            HexadecimalConverter hexadecimalConverter = new HexadecimalConverter();
            string hexadecimalValue = hexadecimalConverter.ConvertTo(name);

            Console.WriteLine($"{name} as Hexadecimal: {hexadecimalValue}");
            Console.WriteLine($"{name} from Hexadecimal to ASCII: {hexadecimalConverter.ConveryFromHexToASCII(hexadecimalValue)}");

            //base64 conversion
            Base64Converter base64Converter   = new Base64Converter();
            string          nameBase64Encoded = base64Converter.StringToBase64(name);

            Console.WriteLine($"{name} as Base64: {nameBase64Encoded}");

            //Output the decoded Base64 string

            string nameBase64Decoded = base64Converter.Base64ToString(nameBase64Encoded);

            Console.WriteLine($"{name} from Base64 to ASCIII: {nameBase64Decoded}");

            //ciphering
            Encrypter encrypter = new Encrypter(name, cipher, encryptionDepth);

            //Single Level Encrytion
            string nameEncryptWithCipher = Encrypter.EncryptWithCipher(name, cipher);

            Console.WriteLine($"Encrypted once using the cipher {{{cipherasString}}} {nameEncryptWithCipher}");

            string nameDecryptWithCipher = Encrypter.DecryptWithCipher(nameEncryptWithCipher, cipher);

            Console.WriteLine($"Decrypted once using the cipher {{{cipherasString}}} {nameDecryptWithCipher}");

            //Deep Encrytion
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(name, cipher, encryptionDepth);

            Console.WriteLine($"Deep Encrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepEncryptWithCipher}");

            string nameDeepDecryptWithCipher = Encrypter.DeepDecryptWithCipher(nameDeepEncryptWithCipher, cipher, encryptionDepth);

            Console.WriteLine($"Deep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}");

            //Base64 Encoded
            Console.WriteLine($"Base64 encoded {name} {encrypter.Base64}");

            string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64);

            Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}");
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter name: ");
            string name = Console.ReadLine();

            String toBinary = StringToBinary2(name);

            Console.Write("Name in Binary: ");
            Console.WriteLine(toBinary);
            Console.WriteLine("Enter name in binary: ");
            string namebinary = Console.ReadLine();
            String binText    = BinaryToString(namebinary);

            Console.Write("Name after conversion from Binary: ");
            Console.WriteLine(binText);
            String toHex = StringToHex2(name);

            Console.WriteLine("");
            Console.Write("Name in HexaDecimal format: ");
            Console.WriteLine(toHex);
            String hexToString = HexToString(toHex);

            Console.Write("Name from Hexadecimal to String: ");
            Console.WriteLine(hexToString);
            String toBase64 = StringToBase64(name);

            Console.WriteLine("");
            Console.Write("Name to Base64 Format: ");
            Console.WriteLine(toBase64);
            String Base64toString = Base64ToString(toBase64);

            Console.Write("Name back to string from Base64: ");

            Console.WriteLine(Base64toString);

            Console.WriteLine("");
            //helloworld
            //string unicodeString = "This string contains the unicode character Pi (\u03a0)";
            int[]  cipher         = new[] { 1, 1, 2, 3, 5, 8, 13 };                     //Fibonacci Sequence
            string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display

            int encryptionDepth = 20;

            Encrypter encrypter = new Encrypter(name, cipher, encryptionDepth);

            //Single Level Encrytion
            string nameEncryptWithCipher = Encrypter.EncryptWithCipher(name, cipher);

            Console.WriteLine($"Encrypted once using the cipher {{{cipherasString}}} {nameEncryptWithCipher}");

            string nameDecryptWithCipher = Encrypter.DecryptWithCipher(nameEncryptWithCipher, cipher);

            Console.WriteLine($"Decrypted once using the cipher {{{cipherasString}}} {nameDecryptWithCipher}");

            //Deep Encrytion
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(name, cipher, encryptionDepth);

            Console.WriteLine($"Deep Encrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepEncryptWithCipher}");

            string nameDeepDecryptWithCipher = Encrypter.DeepDecryptWithCipher(nameDeepEncryptWithCipher, cipher, encryptionDepth);

            Console.WriteLine($"Deep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}");

            //Base64 Encoded
            Console.WriteLine($"Base64 encoded {name} {encrypter.Base64}");

            string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64);

            Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}");
        }
        static void Main(string[] args)
        {
            //string unicodeString = "This string contains the unicode character Pi (\u03a0)";
            int[]  cipher         = new[] { 1, 1, 2, 3, 5, 8, 13 };                     //Fibonacci Sequence
            string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display

            int encryptionDepth = 20;

            //int number;

            //Input User
            Console.WriteLine("Enter username:"******"Menu:\nSelect the conversion for your name\n 1)Binary Conversion\n" +
                              " 2)Hexadecimal Conversions\n " +
                              "3)Base64 Conversion\n " +
                              "4) Encryption\n");



            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine("Enter the number:");
                int number = Convert.ToInt32(Console.ReadLine());

                if (number == 1)
                {
                    //String  Binary
                    string StrBin = StringToBinary(userName);
                    Console.WriteLine("Binary form is: " + StrBin);
                    string BinStr = BinaryToString(StrBin);
                    Console.WriteLine("Binary to ASCII: " + BinStr);
                }

                if (number == 2)
                {
                    //String Hexadecimal
                    string StrHex = StringToHex(userName);
                    Console.WriteLine("Hexadecimal form is: " + StrHex);
                    string HexStr = ConvertHex(StrHex);
                    Console.WriteLine("Hexadecimal to ASCII: " + HexStr);
                }

                if (number == 3)
                {
                    //String Base64
                    string StrBase = StringToBase64(userName);
                    Console.WriteLine("Base64 form is: " + StrBase);
                    string BaseStr = Base64ToString(StrBase);
                    Console.WriteLine("Base64 to ASCII: " + BaseStr);
                }

                if (number == 4)
                {
                    //encryption

                    Encrypter encrypter = new Encrypter(userName, cipher, encryptionDepth);

                    string nameEncryptWithCipher = Encrypter.EncryptWithCipher(userName, cipher);
                    Console.WriteLine($"Encrypted once using the cipher {{{cipherasString}}} {nameEncryptWithCipher}");

                    string nameDecryptWithCipher = Encrypter.DecryptWithCipher(nameEncryptWithCipher, cipher);
                    Console.WriteLine($"Decrypted once using the cipher {{{cipherasString}}} {nameDecryptWithCipher}");

                    //Deep Encrytion
                    string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(userName, cipher, encryptionDepth);
                    Console.WriteLine($"Deep Encrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepEncryptWithCipher}");

                    string nameDeepDecryptWithCipher = Encrypter.DeepDecryptWithCipher(nameDeepEncryptWithCipher, cipher, encryptionDepth);
                    Console.WriteLine($"Deep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}");

                    //Base64 Encoded
                    Console.WriteLine($"Base64 encoded {userName} {encrypter.Base64}");

                    string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64);
                    Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}");
                }
            }
        }