private static string StringToBase64(String name) { Base64Convertor base64Converter = new Base64Convertor(); string base64Value = base64Converter.StringToBase64(name); Console.WriteLine($"{name} as Base64: {base64Value}"); return(base64Value); }
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}"); }
private static string Base64ToASCII(String name) { Base64Convertor base64Converter = new Base64Convertor(); string base64Value = base64Converter.StringToBase64(name); Console.WriteLine($"{name} from base64 to ASCII: {base64Converter.Base64ToString(base64Value)}"); String converted = base64Converter.Base64ToString(base64Value); return(converted); }