CryptoWorkbench/ColumnTransposition.csharp

119 lines
5.1 KiB
Plaintext
Raw Normal View History

Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace AniNIX.Crypto {
public class ColumnTransposition : Cipher {
public override String Description() { return "Column Transposition cipher suite\nFormat is col <command> key1 [key2...]\nThe key format is any word to use for the transposition.\nThis cipher will use an irregular columnar transposition, without padding the input string.\n"; }
public override String Command() { return "col"; }
public ColumnTransposition(Workbench w) : base (w) {}
public ColumnTransposition() {}
/// <summary>
/// Get the order of columns from a key
/// </summary>
/// <returns>an array of ints indicating order</returns>
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
private int[] GetColumnOrder(String key) {
// Create an ordered list and sort from the key.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
List<char> orderList = new List<char>();
for (int i = 0; i < key.Length; i++) {
orderList.Add(key[i]);
}
orderList.Sort();
char[] charArr = orderList.ToArray();
int[] returnOrderIndexes = new int[key.Length];
Console.Write("Found key order: ");
// for each character in the key, find the index in tke sorted array
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
for (int i = 0; i < key.Length; i++) {
for (int j = 0; j < charArr.Length; j++) {
if (key[i] == charArr[j]) {
Console.Write(String.Format("{0} ",j+1));
returnOrderIndexes[j] = i;
break;
}
}
}
Console.WriteLine("");
return returnOrderIndexes;
}
/// <summary>
/// Encrypt a string with the cipher. See https://en.wikipedia.org/wiki/Transposition_cipher#Columnar_transposition for an example of how this works.
/// </summary>
/// <param name="workSpace">The working copy of the cipher</param>
/// <param name="inputText">The original cipher</param>
/// <param name="line">The user input</param>
/// <returns>The encrypted string</returns>
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
public override String Encrypt(String workSpace, String cipher, String[] line) {
if (line.Length < 3) {
Console.Error.WriteLine("Bad formatting.");
return workSpace;
}
//Remove newlines.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
String workSpaceNoNewline = workSpace.Replace("\n","");
char[] changed = workSpaceNoNewline.ToCharArray();
// Create a grid from the key.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
CharGrid cg = new CharGrid(workSpaceNoNewline,line[2].Length,false);
char[][] encryptionGrid = cg.ToArray();
//Get the key order.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
int[] keyOrder = GetColumnOrder(line[2]);
Console.Write(cg.ToString());
int k = 0;
// Replace each character by the character in the right place in the character grid.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
for (int j = 0; j < encryptionGrid[0].Length; j++) {
for (int i = 0; i < encryptionGrid.Length; i++) {
if (i != (encryptionGrid.Length-1) || keyOrder[j] < encryptionGrid[i].Length) {
changed[k] = encryptionGrid[i][keyOrder[j]];
k++;
}
}
}
String toReturn = new String(changed);
//Re-insert newlines.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
for (k = 0; k < workSpace.Length; k++) {
if (workSpace[k] == '\n') {
toReturn = toReturn.Insert(k,"\n");
}
}
return toReturn;
}
/// <summary>
/// Decrypt a string with the cipher
/// </summary>
/// <param name="workSpace">The working copy of the cipher</param>
/// <param name="inputText">The original cipher</param>
/// <param name="line">The user input</param>
/// <returns>The decrypted string</returns>
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
public override String Decrypt(String workSpace, String cipher, String[] line) {
if (line.Length < 3) {
Console.Error.WriteLine("Bad formatting.");
return workSpace;
}
// Remove newlines.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
String workSpaceNoNewline = workSpace.Replace("\n","");
// Find the key order.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
int[] keyOrder = GetColumnOrder(line[2]);
// Create a new chargrid to solve from.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
CharGrid cg = new CharGrid(workSpaceNoNewline,line[2].Length,keyOrder);
Console.Write(cg.ToString());
char[][] cgArray = cg.ToArray();
StringBuilder sb = new StringBuilder();
// For each row, read the row and add to the solution.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
for (int i=0; i < cgArray.Length; i++) {
sb.Append(new String(cgArray[i]));
}
String toReturn = sb.ToString();
// Add back in the newlines.
Converting from Bazaar Old Log: ------------------------------------------------------------ revno: 16 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Sun 2016-07-10 20:22:37 -0500 message: Some fixes for regex, captive shells, analysis ------------------------------------------------------------ revno: 15 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:54:04 -0500 message: Adding captivecrypto.bash shell to go with ForceCommand ------------------------------------------------------------ revno: 14 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-07-07 13:38:21 -0500 message: Updating ------------------------------------------------------------ revno: 13 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-07-05 13:20:34 -0500 message: Adding inline regex lookup Updating ciphers to use standard constructor -- now ciphers can be added from new class, new private in WorkBench, and new instantiation in Workbench constructor ------------------------------------------------------------ revno: 12 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Sat 2016-06-18 10:16:40 -0500 message: GUI enhancements for colorizing. General updates. ------------------------------------------------------------ revno: 11 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-05-09 12:21:57 -0500 message: Updated letter frequency in analysis Added reverse function in Simple Updated bash script with small fixes Updated cryptoworkbench Links function with link to frequency analysis ------------------------------------------------------------ revno: 10 committer: dev <dev@aninix.net> branch nick: CryptoWorkbench timestamp: Fri 2016-04-15 13:03:41 -0500 message: Syncing with new ciphers for Affine, Ubchi, Vignere, and Columnar Transposition. Analytics updated and general fixes included. Paradigm shift for cipher inheritance. ------------------------------------------------------------ revno: 9 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-02-10 15:36:37 -0600 message: Added new class for simple operations, like string to upper/lower and removing spaces. Updated with file reading and writing. Added brute-force for Caesarian ciphers. Updated substition and analysis for better options. Improved CLI ------------------------------------------------------------ revno: 8 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Mon 2016-02-01 13:44:20 -0600 message: Modified analysis to display doubled letters and notify of which letter is repeated when One-to-one query fails to find a one-to-one relationship ------------------------------------------------------------ revno: 7 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-28 10:03:40 -0600 message: Lots of minor fixes. ------------------------------------------------------------ revno: 6 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-20 09:29:54 -0600 message: Makefile had a small typo but it prevented installs. Worth a commit. ------------------------------------------------------------ revno: 5 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Tue 2016-01-19 13:12:12 -0600 message: Added one-to-one query to Analysis for checking if a substitution or rotation remains one-to-one and to acquire the key Moved bash script to ease tab-completion ------------------------------------------------------------ revno: 4 committer: root <root@aninix.net> branch nick: CryptoWorkbench timestamp: Thu 2016-01-14 10:24:02 -0600 message: Renamed README to be consistent with other branches in repo. Added Caesarian functions Added analysis and substitution functions for letter substitution. ------------------------------------------------------------ revno: 3 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:41:05 -0600 message: Added install files ------------------------------------------------------------ revno: 2 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 16:30:10 -0600 message: Adding Makefile and source files. ------------------------------------------------------------ revno: 1 committer: cxford <cxford@aninix.net> branch nick: CryptoWorkbench timestamp: Wed 2016-01-13 10:29:31 -0600 message: Initializing project tree and adding Readme.
2016-08-04 12:10:50 -05:00
for (int i=0; i < workSpace.Length; i++) {
if (workSpace[i] == '\n') {
toReturn = toReturn.Insert(i,"\n");
}
}
return toReturn;
}
}
}