Пример #1
0
        private static string HexToASCII(String name)
        {
            HexadecimalConverter hexadecimalConverter = new HexadecimalConverter();
            string hexadecimalValue = hexadecimalConverter.ConvertTo(name);

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

            String converted = hexadecimalConverter.ConveryFromHexToASCII(hexadecimalValue);



            return(converted);
        }
Пример #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}");
        }
        static void Main(string[] args)
        {
            string name = "Vrushabh Patel";

            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)}");
        }
Пример #4
0
        static void Main(string[] args)
        {
            string name;

            //getting name
            Console.WriteLine("enter your name: ");
            name = Console.ReadLine();
            string unicodeString = name;
            //binary conversion


            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)}");

            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(unicodeString, cipher, encryptionDepth);

            //Single Level Encrytion
            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}");

            //Deep Encrytion
            string nameDeepEncryptWithCipher = encrypter.DeepEncryptWithCipher(unicodeString, 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 {unicodeString} {encrypter.Base64}");

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

            Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}");
        }
Пример #5
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}");
        }
Пример #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Type yout full name : ");
            string Name = Console.ReadLine();

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

            Console.WriteLine($"\n{Name} as Binary: {binaryValue}");

            Console.WriteLine("\nCopy and Paste your Binary full name here : ");
            string binvalue = Console.ReadLine();

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

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

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

            string nameBase64Encoded = StringToBase64(Name);

            Console.WriteLine($"\n{Name} as Base64: {nameBase64Encoded}");


            string nameBase64Decoded = Base64ToString(nameBase64Encoded);

            Console.WriteLine($"\n{Name} from Base64 to ASCII: {nameBase64Decoded}");

            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);

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

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

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

            Console.WriteLine($"\nDeep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}");
        }
 /// Asks users for Hex, prints Ascii value
 static void PrintASCIIfromHex()
 {
     try
     {
         Console.WriteLine("\nPlease enter Hex to print as ASCII (visible characters from 021 to 07e): ");
         string userhex = Console.ReadLine();
         HexadecimalConverter hexconverter = new HexadecimalConverter();
         string hexname = hexconverter.ConveryFromHexToASCII(userhex);
         Console.WriteLine($"The Hex value of {userhex} is {hexname}");
     }
     catch
     {
         Console.WriteLine("Please try again: ");
         string userhex = Console.ReadLine();
         HexadecimalConverter hexconverter = new HexadecimalConverter();
         string hexname = hexconverter.ConveryFromHexToASCII(userhex);
         Console.WriteLine($"The Hex value of {userhex} is {hexname}");
     }
 }
Пример #8
0
        static void Main(string[] args)
        {
            string val;

            Console.Write("Enter a name: ");
            val = Console.ReadLine();


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

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

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

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

            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(val, cipher, encryptionDepth);

            Console.WriteLine($"Base64 encoded {val} {encrypter.Base64}");

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

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

            //Deep Encrytion
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(val, 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}");
        }
Пример #9
0
        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}");
        }
Пример #10
0
        static void Main(string[] args)
        {
            // string unicodeString = "This string contains the unicode character Pi (\u03a0)";

            Console.WriteLine("****************************ASCII to Binary************************");

            Console.WriteLine("Enter Your Name Please:");
            String HexaCoding = Console.ReadLine();



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

            Console.WriteLine($"{HexaCoding} as Binary: {binaryValue}");

            Console.WriteLine("****************************Binary to ASCII************************");

            Console.WriteLine("Enter binary version of your name");
            String binary = Console.ReadLine();

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



            Console.WriteLine("****************************ASCII to Hexa Decimal************************");

            Console.WriteLine("This is for Hexa.../n Enter Your Name Please:");
            String hexaCoding = Console.ReadLine();

            HexadecimalConverter hexadecimalConverter = new HexadecimalConverter();
            string hexValue = hexadecimalConverter.ConvertTo(HexaCoding);

            Console.WriteLine($"{HexaCoding} as Hexa: {hexValue}");


            Console.WriteLine("****************************Hexa Decimal to ASCII************************");
            Console.WriteLine("Enter Hexa Decimal version of your name");
            String hexa = Console.ReadLine();

            Console.WriteLine($"{hexa} from Hexa Decimal to ASCII: {hexadecimalConverter.ConveryFromHexToASCII(hexa)}");



            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(HexaCoding, cipher, encryptionDepth);



            Console.WriteLine("****************************ASCII to Base64************************");
            Console.WriteLine($"Base64 encoded {HexaCoding} {encrypter.Base64}");

            Console.WriteLine("****************************Base64 to ASCII************************");
            string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64);

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



            //Single Level Encrytion
            //string nameEncryptWithCipher = Encrypter.EncryptWithCipher(HexaCoding, 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 with encryptionDepth 20
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(HexaCoding, 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}");
        }
        static void Main(string[] args)
        {
            Console.WriteLine("**********************BINARY CONVERSION**********************");
            Console.WriteLine("Enter your name:");
            string name = Console.ReadLine();

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

            Console.WriteLine($"{name} as Binary: {binaryValue}");

            Console.WriteLine("Enter the binary version of your name:");
            string binaryName = Console.ReadLine();

            Console.WriteLine($"Binary code entered in ASCII format: {binaryConverter.ConvertBinaryToString(binaryValue)}");

            Console.WriteLine("**********************HEXADECIMAL 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)}");

            Console.WriteLine("**********************BASE64 CONVERSION**********************");
            Base64Converter base64Converter = new Base64Converter();
            string          base64Value     = base64Converter.StringToBase64(name);

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

            Console.WriteLine("**********************ENCRYPTION AND DECRYPTION**********************");

            //Output the decoded Base64 string
            string nameBase64Decoded = base64Converter.Base64ToString(base64Value);

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

            //string unicodeString = "This string contains the unicode character Pi (\u03a0)";
            int[]  cipher         = new[] { 0, 2, 4, 6, 8, 10, 12 };                    //even numbers
            string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display

            int       encryptionDepth = 20;
            string    myName          = "VARGHESE";
            Encrypter encrypter       = new Encrypter(myName, cipher, encryptionDepth);

            ////Single Level Encrytion
            //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}");

            //Deep Encrytion
            string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(myName, 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 {myName} {encrypter.Base64}");

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