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); }
static void Main(string[] args) { int[] cipher = new[] { 1, 1, 2, 3, 5, 8, 13 }; //Fibonacci Sequence string cipherasString = String.Join(",", cipher.Select(x => x.ToString())); //FOr display Console.WriteLine("Enter the name for string to binary conversion "); var name = Console.ReadLine(); int encryptionDepth = 20; Encrypter encrypter = new Encrypter(name, cipher, encryptionDepth); //String to binary with user input var nameToBinary = encrypter.Binary; Console.WriteLine($"{name} in binary is {nameToBinary}"); //Binary to ASCII //Console.WriteLine("Enter the binary value for conversion"); //var binary = Console.ReadLine(); //var binaryToName = Encrypter.ConvertToASCII(binary); var binaryToName = Encrypter.ConvertToASCII(nameToBinary); Console.WriteLine($"{nameToBinary} in ASCII format is {binaryToName} "); //String to Hexadecimal var nameToHexa = encrypter.Hexadecimal; Console.WriteLine($"{name} in hexadecimal format is {nameToHexa}"); //Hexa to ASCII //Console.WriteLine("Enter the hexadecimal value for conversion"); //var hexa = Console.ReadLine(); var hexaToName = Encrypter.ConvertHexToASCII(nameToHexa); Console.WriteLine($"{nameToHexa} in ASCII is {hexaToName}"); //Base64 Encoded Console.WriteLine($"Base64 encoded {name} {encrypter.Base64}"); //Base64 Decoded string base64toPlainText = Encrypter.Base64ToString(encrypter.Base64); Console.WriteLine($"Base64 decoded {encrypter.Base64} {base64toPlainText}"); //Deep Encryption string nameDeepEncryptWithCipher = Encrypter.DeepEncryptWithCipher(name, cipher, encryptionDepth); Console.WriteLine($"Deep Encrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepEncryptWithCipher}"); //Deep Decryption string nameDeepDecryptWithCipher = Encrypter.DeepDecryptWithCipher(name, cipher, encryptionDepth); Console.WriteLine($"Deep Decrypted {encryptionDepth} times using the cipher {{{cipherasString}}} {nameDeepDecryptWithCipher}"); }
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) { 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}"); }
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}"); }
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("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}"); } } }