コード例 #1
0
    static void Main(string[] args)
    {
        Console.WriteLine("Enter a string to be encrypted: ");
        string userString  = Console.ReadLine();
        string cleanString = EncryptAndDecrypt.CleanString(userString);

        EncryptAndDecrypt.SetCypherKey();
        EncryptAndDecrypt.SetCypherWord();



        Console.WriteLine($"\nYour entry: {cleanString} is in plain text form.");



        string encryptedWithSingleKey = EncryptAndDecrypt.EncryptWithKey(cleanString);

        Console.WriteLine($"\nEncrpted: String with a single key: {encryptedWithSingleKey}");
        Console.WriteLine($"Decrypted: {EncryptAndDecrypt.DecryptWithKey(encryptedWithSingleKey)}");



        string encryptedWithWordKey = EncryptAndDecrypt.EncryptWithWord(cleanString);

        Console.WriteLine($"\nEncrypted: String encrypted with a word: {encryptedWithWordKey}");
        Console.WriteLine($"Decrypted: {EncryptAndDecrypt.DecryptWithWord(encryptedWithWordKey)}");



        string encryptedWithStringKey = EncryptAndDecrypt.EncryptWithString(cleanString);

        Console.WriteLine($"\nEncrypted: String encrypted with a word and a string: {encryptedWithStringKey}");
        Console.WriteLine($"Decrypted: {EncryptAndDecrypt.DecryptWithString(encryptedWithStringKey)}");
    }