Fixes from usability testing
This commit is contained in:
		@@ -7,7 +7,7 @@ using System.Collections.Generic;
 | 
				
			|||||||
namespace AniNIX.Crypto {
 | 
					namespace AniNIX.Crypto {
 | 
				
			||||||
    public class Affine : Cipher {
 | 
					    public class Affine : Cipher {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override String Description() { return "The Affine cipher\nKey format is two numbers, where the second number is coprime to the first."; } 
 | 
					        public override String Description() { return "The Affine cipher\nKey format is two numbers, where the second number is coprime to the first.\n\nExample: affine encrypt 5 3\n\n"; } 
 | 
				
			||||||
        public override String Command() {return "affine";} 
 | 
					        public override String Command() {return "affine";} 
 | 
				
			||||||
        public Affine(Workbench w) : base (w) {}
 | 
					        public Affine(Workbench w) : base (w) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,7 +62,6 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
            for (int x=1; x < 27; x++) {
 | 
					            for (int x=1; x < 27; x++) {
 | 
				
			||||||
                //Try to find a number where the input times that number mod 26 is 1. If we roll through 26 numbers and don't find it, there isn't one.
 | 
					                //Try to find a number where the input times that number mod 26 is 1. If we roll through 26 numbers and don't find it, there isn't one.
 | 
				
			||||||
                if ((a*x)%26 == 1) {
 | 
					                if ((a*x)%26 == 1) {
 | 
				
			||||||
                    Console.WriteLine(String.Format("Found Multiplicative Inverse of {0}",x));
 | 
					 | 
				
			||||||
                    return x;
 | 
					                    return x;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
    public class Analysis : Cipher {
 | 
					    public class Analysis : Cipher {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private Substitution _sb;
 | 
					        private Substitution _sb;
 | 
				
			||||||
        public override String Description() { return "Analysis tools"; }
 | 
					        public override String Description() { return "These are analysis tools to help understand ciphers."; }
 | 
				
			||||||
        public override String Command() { return "analysis"; }
 | 
					        public override String Command() { return "analysis"; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Analysis(Workbench w) : base (w) {
 | 
					        public Analysis(Workbench w) : base (w) {
 | 
				
			||||||
@@ -45,9 +45,16 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                case "charinfo":
 | 
					                case "charinfo":
 | 
				
			||||||
                    CharInfo(line);
 | 
					                    CharInfo(line);
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                default:
 | 
					                case "hexprint": 
 | 
				
			||||||
 | 
					                    HexPrint(workSpace);
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "help":
 | 
				
			||||||
 | 
					                case "":
 | 
				
			||||||
                    GetHelp();
 | 
					                    GetHelp();
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
 | 
					                default: 
 | 
				
			||||||
 | 
					                    Console.Error.WriteLine("Invalid command. Type 'analysis help' for more.");
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return workSpace;
 | 
					            return workSpace;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -56,7 +63,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        /// Show this help text
 | 
					        /// Show this help text
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public override void GetHelp() {
 | 
					        public override void GetHelp() {
 | 
				
			||||||
            Console.WriteLine("Analysis tools help:\nfreq         -- Get frequency of characters.\nfreqinfo     -- Return the most common English frequencies.\none-to-one   -- See if there is a direct correspondence of characters between cipher and workspace.\ndiff a b     -- get the difference between two characters\ncharinfo     -- get the info about a character");
 | 
					            Console.WriteLine("Analysis tools help:\nanalysis freq         -- Get frequency of characters.\nanalysis freqinfo     -- Return the most common English frequencies.\nanalysis one-to-one   -- See if there is a direct correspondence of characters between cipher and workspace.\nanalysis diff a b     -- get the difference between two characters\nanalysis charinfo c   -- get the info about a character c.\nanalysis hexprint -- print the hex and decimal value of each character in the workspace.");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
@@ -344,6 +351,13 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void HexPrint(String line) {
 | 
				
			||||||
 | 
					            Console.WriteLine("Char - Dec - Hex");
 | 
				
			||||||
 | 
					            foreach (char i in line.ToCharArray()) {
 | 
				
			||||||
 | 
					                Console.WriteLine("{0} -- {1} -- {2}",i,(int)i,Convert.ToByte(i));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        //Analysis doesn't handle encryption or decryption, but we want to use the same code for subscribing.
 | 
					        //Analysis doesn't handle encryption or decryption, but we want to use the same code for subscribing.
 | 
				
			||||||
        public override String Encrypt(string workSpace,String ciphetText,String[] line) { return workSpace; }
 | 
					        public override String Encrypt(string workSpace,String ciphetText,String[] line) { return workSpace; }
 | 
				
			||||||
        public override String Decrypt(string workSpace,String ciphetText,String[] line) { return workSpace; }
 | 
					        public override String Decrypt(string workSpace,String ciphetText,String[] line) { return workSpace; }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ using System.Collections.Generic;
 | 
				
			|||||||
namespace AniNIX.Crypto {
 | 
					namespace AniNIX.Crypto {
 | 
				
			||||||
    public class Caesarian : Cipher {
 | 
					    public class Caesarian : Cipher {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override String Description() { return "Caesarian cipher suite\nKey format is a numeric shift."; }
 | 
					        public override String Description() { return "Caesarian ciphers shift letters by a numeric offset. Key format is thus a number."; }
 | 
				
			||||||
        public override String Command() { return "caesar"; }
 | 
					        public override String Command() { return "caesar"; }
 | 
				
			||||||
        public Caesarian(Workbench w) : base (w) {}
 | 
					        public Caesarian(Workbench w) : base (w) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -42,7 +42,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public override void GetHelp() {
 | 
					        public override void GetHelp() {
 | 
				
			||||||
            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
					            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
				
			||||||
            Console.WriteLine("encrypt key         -- encrypt with the key\ndecrypt key         -- decrypt with the key\nbrute               -- brute-force for keys\nhelp                -- show this helptext.");
 | 
					            Console.WriteLine("caesar encrypt key         -- encrypt with the key\ncaesar decrypt key         -- decrypt with the key\ncaesar brute               -- brute-force for keys\ncaesar help                -- show this helptext.");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,6 +45,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                case "decrypt":
 | 
					                case "decrypt":
 | 
				
			||||||
                    return Decrypt(workSpace,inputText,line);
 | 
					                    return Decrypt(workSpace,inputText,line);
 | 
				
			||||||
                case "help": 
 | 
					                case "help": 
 | 
				
			||||||
 | 
					                case "": 
 | 
				
			||||||
                    GetHelp();
 | 
					                    GetHelp();
 | 
				
			||||||
                    return workSpace;
 | 
					                    return workSpace;
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
@@ -58,8 +59,15 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name=line>This is the incoming line and we use it to get the cipher name</param>
 | 
					        /// <param name=line>This is the incoming line and we use it to get the cipher name</param>
 | 
				
			||||||
        public virtual void GetHelp() {
 | 
					        public virtual void GetHelp() {
 | 
				
			||||||
            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
					            String command = Command();
 | 
				
			||||||
            Console.WriteLine("encrypt key         -- encrypt with the key\ndecrypt key         -- decrypt with the key\nhelp                -- show this helptext.");
 | 
					            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",command,Description()));
 | 
				
			||||||
 | 
					            Console.WriteLine("Usage:");
 | 
				
			||||||
 | 
					            Console.Write(command);
 | 
				
			||||||
 | 
					            Console.WriteLine(" encrypt key         -- encrypt with the key");
 | 
				
			||||||
 | 
					            Console.Write(command);
 | 
				
			||||||
 | 
					            Console.WriteLine(" decrypt key         -- decrypt with the key"); 
 | 
				
			||||||
 | 
					            Console.Write(command);
 | 
				
			||||||
 | 
					            Console.WriteLine(" help                -- show this helptext.");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary> 
 | 
					        /// <summary> 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        private void ReadCipher(String[] line) {
 | 
					        private void ReadCipher(String[] line) {
 | 
				
			||||||
            // If a filename's not provided.
 | 
					            // If a filename's not provided.
 | 
				
			||||||
            if (line == null || line.Length !=2) {
 | 
					            if (line == null || line.Length !=2) {
 | 
				
			||||||
                Console.WriteLine("Please paste your ciphertext.");
 | 
					                Console.WriteLine("Please paste your ciphertext. End your input with a trailing newline.");
 | 
				
			||||||
                string readLn = Console.ReadLine();
 | 
					                string readLn = Console.ReadLine();
 | 
				
			||||||
                StringBuilder sb = new StringBuilder();
 | 
					                StringBuilder sb = new StringBuilder();
 | 
				
			||||||
                //Read lines from stdin until a blank line is given.
 | 
					                //Read lines from stdin until a blank line is given.
 | 
				
			||||||
@@ -74,6 +74,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                    this._isBlind = true;
 | 
					                    this._isBlind = true;
 | 
				
			||||||
                    ReadCipher(null);
 | 
					                    ReadCipher(null);
 | 
				
			||||||
                    // Otherwise, try to use the first argument as a filename.
 | 
					                    // Otherwise, try to use the first argument as a filename.
 | 
				
			||||||
 | 
					                } else if (args[0].Equals("--help") || args[0].Equals("-h")) {
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    String[] line = new String[2];
 | 
					                    String[] line = new String[2];
 | 
				
			||||||
                    line[0] = "reread";
 | 
					                    line[0] = "reread";
 | 
				
			||||||
@@ -86,26 +87,27 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                System.Environment.Exit(1);
 | 
					                System.Environment.Exit(1);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // Seed the helptext.
 | 
					            // Seed the helptext.
 | 
				
			||||||
            HelpText.Append("You can get help on any command by running \"<command> help\".\nSuppress printing the cipher with a trailing ;.\nAvailable commands:\n");
 | 
					            HelpText.Append("Available commands:\n");
 | 
				
			||||||
            // Don't tell users about things they can't use.
 | 
					            // Don't tell users about things they can't use.
 | 
				
			||||||
            if (!_isBlind) {
 | 
					            if (!_isBlind) {
 | 
				
			||||||
                HelpText.Append("reread           -- Read in a new cipher\n");
 | 
					                HelpText.Append("reread           -- Read in a new cipher\n");
 | 
				
			||||||
                HelpText.Append("write            -- write the workspace to a file\n");
 | 
					                HelpText.Append("write            -- write the workspace to a file\n");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            HelpText.Append("regex            -- Check for strings with the two regex arguments: [search] [filter]\n");
 | 
					 | 
				
			||||||
            HelpText.Append("reset            -- reset workspace to the ciphertext.\n");
 | 
					            HelpText.Append("reset            -- reset workspace to the ciphertext.\n");
 | 
				
			||||||
 | 
					            HelpText.Append("regex            -- Check for strings with the two regex arguments: [search] [filter]\n");
 | 
				
			||||||
            HelpText.Append("links            -- show some helpful links\n");
 | 
					            HelpText.Append("links            -- show some helpful links\n");
 | 
				
			||||||
            HelpText.Append("help             -- show this HelpText\n");
 | 
					 | 
				
			||||||
            HelpText.Append("print            -- show the current workspace\n");
 | 
					            HelpText.Append("print            -- show the current workspace\n");
 | 
				
			||||||
            HelpText.Append("display          -- alias of print\n");
 | 
					            HelpText.Append("display          -- alias of print\n");
 | 
				
			||||||
            HelpText.Append("exit             -- exit and show the result.\n");
 | 
					 | 
				
			||||||
            HelpText.Append("quit             -- alias of exit.\n");
 | 
					 | 
				
			||||||
            // Initialize the ciphersuites.
 | 
					            // Initialize the ciphersuites.
 | 
				
			||||||
            Object[] cipherArgs = { (Object)this }; 
 | 
					            Object[] cipherArgs = { (Object)this }; 
 | 
				
			||||||
            foreach (Type cipherType in Assembly.GetAssembly(typeof(Cipher)).GetTypes()
 | 
					            foreach (Type cipherType in Assembly.GetAssembly(typeof(Cipher)).GetTypes()
 | 
				
			||||||
                    .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Cipher)))) {
 | 
					                    .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Cipher)))) {
 | 
				
			||||||
                _ciphers.Add((Cipher)Activator.CreateInstance(cipherType, cipherArgs));
 | 
					                _ciphers.Add((Cipher)Activator.CreateInstance(cipherType, cipherArgs));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            HelpText.Append("exit             -- exit and show the result.\n");
 | 
				
			||||||
 | 
					            HelpText.Append("quit             -- alias of exit.\n");
 | 
				
			||||||
 | 
					            HelpText.Append("help             -- show this HelpText\n");
 | 
				
			||||||
 | 
					            HelpText.Append("\nYou can get help on any command by running \"<command> help\".\nSuppress printing the cipher with a trailing ;.\n\nCommand structure is: {module} {operation} [{keypart}]*\n\nExample commands:\n\"caesar encrypt 13\" -- Encrypt the input with a Caesarian cipher of offset 13.\n\"affine help\" -- Get help on the Affine cipher.\n\"simple stripspace\" -- Use the Simple module to remove spaces.\n\"analysis one-to-one\" -- Check if the workspace is a one-to-one correlation with the input.\n\n");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary> 
 | 
					        /// <summary> 
 | 
				
			||||||
@@ -124,7 +126,9 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Display this workbench to stdout with colors.
 | 
					        /// Display this workbench to stdout with colors.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public void Print() {
 | 
					        //  <param name="verbose">Set to true if you want verbose prints.
 | 
				
			||||||
 | 
					        public void Print() { Print(false); }
 | 
				
			||||||
 | 
					        public void Print(bool verbose) {
 | 
				
			||||||
            Console.ForegroundColor = ConsoleColor.Red;
 | 
					            Console.ForegroundColor = ConsoleColor.Red;
 | 
				
			||||||
            Console.WriteLine("Input:");
 | 
					            Console.WriteLine("Input:");
 | 
				
			||||||
            Console.ResetColor();
 | 
					            Console.ResetColor();
 | 
				
			||||||
@@ -132,6 +136,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
            Console.ForegroundColor = ConsoleColor.Red;
 | 
					            Console.ForegroundColor = ConsoleColor.Red;
 | 
				
			||||||
            Console.WriteLine("Workspace:");
 | 
					            Console.WriteLine("Workspace:");
 | 
				
			||||||
            Console.ResetColor();
 | 
					            Console.ResetColor();
 | 
				
			||||||
 | 
					            if (verbose) return;
 | 
				
			||||||
            List<String> topletters = Analysis.GetMostCommonLetters(workSpace).Take(5).ToList();//cyan
 | 
					            List<String> topletters = Analysis.GetMostCommonLetters(workSpace).Take(5).ToList();//cyan
 | 
				
			||||||
            List<String> bigrams = Analysis.Top(Analysis.GetSubstrings(workSpace,2)); //yellow
 | 
					            List<String> bigrams = Analysis.Top(Analysis.GetSubstrings(workSpace,2)); //yellow
 | 
				
			||||||
            List<String> trigrams = Analysis.Top(Analysis.GetSubstrings(workSpace,3));//magenta
 | 
					            List<String> trigrams = Analysis.Top(Analysis.GetSubstrings(workSpace,3));//magenta
 | 
				
			||||||
@@ -199,10 +204,12 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
            Console.ForegroundColor = ConsoleColor.Red;            
 | 
					            Console.ForegroundColor = ConsoleColor.Red;            
 | 
				
			||||||
            Console.WriteLine("### Welcome to the AniNIX::CryptoWorkbench ###");
 | 
					            Console.WriteLine("### Welcome to the AniNIX::CryptoWorkbench ###");
 | 
				
			||||||
            Console.ResetColor();
 | 
					            Console.ResetColor();
 | 
				
			||||||
 | 
					            Console.WriteLine("Type help for assistance.\n");
 | 
				
			||||||
 | 
					            Print();
 | 
				
			||||||
            try { 
 | 
					            try { 
 | 
				
			||||||
                // Set the initial command to be show the helptext.
 | 
					                // Set the initial command to be show the helptext.
 | 
				
			||||||
                string command = "help";
 | 
					                string command = "";
 | 
				
			||||||
                string read = "help";
 | 
					                string read = "";
 | 
				
			||||||
                string[] line;
 | 
					                string[] line;
 | 
				
			||||||
                bool showCipher=true;
 | 
					                bool showCipher=true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -275,7 +282,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                    // Show the cipher if the user asked.
 | 
					                    // Show the cipher if the user asked.
 | 
				
			||||||
                    if (showCipher) Print();
 | 
					                    if (showCipher) Print();
 | 
				
			||||||
                    // Display an AniNIX-standard prompt.
 | 
					                    // Display an AniNIX-standard prompt.
 | 
				
			||||||
                    Console.Write("\nWhat command would you like to execute?\n");
 | 
					                    Console.Write("\nCW ");
 | 
				
			||||||
                    Console.ForegroundColor = ConsoleColor.Red;
 | 
					                    Console.ForegroundColor = ConsoleColor.Red;
 | 
				
			||||||
                    Console.Write("|");
 | 
					                    Console.Write("|");
 | 
				
			||||||
                    Console.ResetColor();
 | 
					                    Console.ResetColor();
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								PKGBUILD
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								PKGBUILD
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
# Maintainer: Shikoba Kage <darkfeather@aninix.net>
 | 
					# Maintainer: Shikoba Kage <darkfeather@aninix.net>
 | 
				
			||||||
pkgname=cryptoworkbench
 | 
					pkgname=cryptoworkbench
 | 
				
			||||||
pkgver=0.1
 | 
					pkgver=0.1-1
 | 
				
			||||||
pkgrel=1
 | 
					pkgrel=1
 | 
				
			||||||
epoch=
 | 
					epoch=
 | 
				
			||||||
pkgdesc="AniNIX::CryptoWorkbench \\\\ Simple Cryptography Utility"
 | 
					pkgdesc="AniNIX::CryptoWorkbench \\\\ Simple Cryptography Utility"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,6 +33,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                case "reverse":
 | 
					                case "reverse":
 | 
				
			||||||
                    return ReverseString(workSpace);
 | 
					                    return ReverseString(workSpace);
 | 
				
			||||||
                case "help": 
 | 
					                case "help": 
 | 
				
			||||||
 | 
					                case "": 
 | 
				
			||||||
                    GetHelp();
 | 
					                    GetHelp();
 | 
				
			||||||
                    return workSpace;
 | 
					                    return workSpace;
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
@@ -47,7 +48,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        /// <param name=line>This is the incoming line and we use it to get the cipher name</param>
 | 
					        /// <param name=line>This is the incoming line and we use it to get the cipher name</param>
 | 
				
			||||||
        public override void GetHelp() {
 | 
					        public override void GetHelp() {
 | 
				
			||||||
            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
					            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
				
			||||||
            Console.WriteLine("shiftup             -- Make all uppercase\nshiftdown           -- Make all lowercase\nstripspace          -- strip spaces from String\nreverse             -- reverse the string\nhelp                -- show this helptext.");
 | 
					            Console.WriteLine("Usage:\nsimple shiftup             -- Make all uppercase\nsimple shiftdown           -- Make all lowercase\nsimple stripspace          -- strip spaces from String\nsimple reverse             -- reverse the string\nsimple help                -- show this helptext.");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        public char[] EngCommon = {'e','t','a','o','i','n','s','h','r','d','l','u','c','m','w','f','y','g','p','b','v','k','x','j','q','z'};
 | 
					        public char[] EngCommon = {'e','t','a','o','i','n','s','h','r','d','l','u','c','m','w','f','y','g','p','b','v','k','x','j','q','z'};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public override String Description() { return "Subsitution cipher suite\nKey format is \"E[EEE]=d[ddd]\", where E is the character in the cipher and d is the intended character in the workspace."; }
 | 
					        public override String Description() { return "Substitution ciphers replace characters one-for-one.\nKey format is \"E[EEE]=d[ddd]\", where E is the character in the cipher and d is the intended character in the workspace.\n\nSubstitution can take multiple keys in a single invocation.\n\nExample usage:\nsub decrypt I=j       -- replace each I in the input with j in the workspace.\nsub decrypt IN=jq     -- replace each I in the input with j in the workspace, and each N in the input with q.\nsub decrypt IN=jq K=c -- do the above, and additionally replace each K with c.\n"; }
 | 
				
			||||||
        public override String Command() { return "sub"; }
 | 
					        public override String Command() { return "sub"; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Substitution(Workbench w) : base (w) {}
 | 
					        public Substitution(Workbench w) : base (w) {}
 | 
				
			||||||
@@ -32,6 +32,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
                case "try-common": 
 | 
					                case "try-common": 
 | 
				
			||||||
                    return TryCommon(inputText);
 | 
					                    return TryCommon(inputText);
 | 
				
			||||||
                case "help": 
 | 
					                case "help": 
 | 
				
			||||||
 | 
					                case "":
 | 
				
			||||||
                    GetHelp();
 | 
					                    GetHelp();
 | 
				
			||||||
                    return workSpace;
 | 
					                    return workSpace;
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
@@ -46,7 +47,7 @@ namespace AniNIX.Crypto {
 | 
				
			|||||||
        /// <param name=line>This is the incoming line and we use it to get the cipher name</param>
 | 
					        /// <param name=line>This is the incoming line and we use it to get the cipher name</param>
 | 
				
			||||||
        public  override void GetHelp() {
 | 
					        public  override void GetHelp() {
 | 
				
			||||||
            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
					            Console.WriteLine(String.Format("Help for the {0} cipher suite.\n{1}\n",Command(),Description()));
 | 
				
			||||||
            Console.WriteLine("encrypt key[s]         -- encrypt with the key[s]\ndecrypt key[s]         -- decrypt with the key[s]\ntry-common          -- try common sub keys\nhelp                -- show this helptext.");
 | 
					            Console.WriteLine("Usage:\nsub encrypt key[s]     -- encrypt with the key[s]\nsub decrypt key[s]     -- decrypt with the key[s]\ntry-common            -- try common sub keys\nhelp                  -- show this helptext.");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user