Ignore:
Timestamp:
Jul 1, 2009, 11:53:33 AM (13 years ago)
Author:
angelov
Message:

Some spelling mistakes fixed. Commentaries added. Reference to the used algorithm.

Location:
trunk/CrypPlugins/MonoalphabeticAnalysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/MonoalphabeticAnalysis/MonoalphabeticAnalysis.cs

    r365 r372  
    3737    {
    3838        private string stringOutput = "";
    39         private string statisticTextFrequencyInput_Monograms="";
    40         private string statisticTextFrequencyInput_Digrams="";
    41         private string cipherTextFrequencyInput_Monograms="";
    42         private string decipherAttempt_Digrams=""; //After the initial alphabet is proposed and decrypt from substitution plug-in is generated, the result is analysed with Frequencytest concerning digrams and fed back to MonoalphabeticAnalysis as input.
     39        private string textStatisticInput_Monograms = ""; //Generated from FrequencyTest. Contains monogram/letter frequencies of  arbitrary text. Used for initial mapping and proposal of alphabet.
     40        private string textStatisticInput_Digrams="";//Generated from FrequencyTest. It is Used in the Cost Function for each proposed alphabet to generate the alphabetGoodness number.
     41        private string cipherTextFrequencyInput_Monograms = ""; //Generated from FrequencyTest. Compared with textStatisticInput_Monograms and used for initial mapping of letters and first proposal alphabet.
     42        private string decipherAttempt_Digrams = ""; //Generated from FrequencyTest. After the initial alphabet is proposed and decryption attempt from substitution plug-in is generated, the result is analysed with Frequencytest set on digrams and fed to MonoalphabeticAnalysis as input. It is used on the second pass through the execute method.
    4343        public string GoodAlphabet = null;
    4444        public string NextAlphabet = null;
    45         private double alphabetGoodnes = 0;
     45        private double alphabetGoodnes = 0;//result of the cost function. Used in ReturnAlphabetGoodness method.
    4646        public int AlphabetCounterA = 1;
    4747        public int AlphabetcounterB = 1;
     
    5252        #region Properties (Inputs/Outputs)
    5353
    54         [PropertyInfo(Direction.Input, "StatisticTextFrequencyInput_Monograms", "StatisticTextFrequencyInput_Monograms", "", false, true, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
    55         public string StatisticTextFrequencyInput_Monograms
     54        [PropertyInfo(Direction.Input, "TextStatisticInput_Monograms", "TextStatisticInput_Monograms", "", false, true, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
     55        public string TextStatisticInput_Monograms
    5656        {
    5757            get
    5858            {
    59                 return statisticTextFrequencyInput_Monograms;
    60             }
    61             set { statisticTextFrequencyInput_Monograms = value; OnPropertyChanged("StatisticTextFrequencyInput_Monograms"); }
     59                return textStatisticInput_Monograms;
     60            }
     61            set { textStatisticInput_Monograms = value; OnPropertyChanged("textStatisticInput_Monograms"); }
    6262        }
    6363
     
    6868            get
    6969            {
    70                 return statisticTextFrequencyInput_Digrams;
    71             }
    72             set { statisticTextFrequencyInput_Digrams = value; OnPropertyChanged("StatisticTextFrequencyInput_Digrams"); }
     70                return textStatisticInput_Digrams;
     71            }
     72            set { textStatisticInput_Digrams = value; OnPropertyChanged("StatisticTextFrequencyInput_Digrams"); }
    7373        }
    7474
     
    164164       
    165165        //////////////
    166         //EXECUTE!!!//
     166        //EXECUTE!!!//    //IMPLEMENTATION ATTEMPT OF THE ALGORITHM: Jakobsen, Thomas(1995)'A FAST METHOD FOR CRYPTANALYSIS OF SUBSTITUTION CIPHERS',Cryptologia,19:3,265 — 274
    167167        //////////////
    168168     
    169         public void Execute()
     169        public void Execute() 
    170170        {
    171171           
     
    173173            if (cipherTextFrequencyInput_Monograms != "")
    174174            {
    175                    //if Optional Statistical input not used -> use variables from pre-analysed Text (James Clavel's Shogun
    176                  if (statisticTextFrequencyInput_Monograms == "") statisticTextFrequencyInput_Monograms = ShogunStatistics.ShogunMonograms;
     175                   //if Optional Statistical input not used -> use variables from pre-analysed Text (James Clavel's Shogun in our case
     176                if (TextStatisticInput_Monograms == "") textStatisticInput_Monograms = ShogunStatistics.ShogunMonograms;
    177177
    178178
     
    181181                     //GoodAlphabet equals null means initial alphabet should be generated
    182182                    string alphabet = "";
    183                     ArrayList mapping1 = InitialMapping(cipherTextFrequencyInput_Monograms, statisticTextFrequencyInput_Monograms);
     183                    ArrayList mapping1 = InitialMapping(cipherTextFrequencyInput_Monograms, textStatisticInput_Monograms);
    184184
    185185                    alphabet = AlphabetFromMapping(mapping1);
     
    353353       public ArrayList InitialMapping(string cyString, string statString)
    354354        {
    355             if (statisticTextFrequencyInput_Monograms == "") statisticTextFrequencyInput_Monograms = ShogunStatistics.ShogunMonograms;
     355            if (textStatisticInput_Monograms == "") textStatisticInput_Monograms = ShogunStatistics.ShogunMonograms;
    356356            ArrayList cipherTextFrequencies = ReturnSortedList(cyString, SortElements.SortElemetsBy.byFrequency);
    357357            ArrayList statisticFrequencies = ReturnSortedList(statString, SortElements.SortElemetsBy.byFrequency);
     
    407407      public double ReturnAlphabetGoodness()
    408408      {
    409           if (statisticTextFrequencyInput_Digrams == "") StatisticTextFrequencyInput_Digrams = ShogunStatistics.ShogunDigrams;//if Optional Statistical input not used -> use variables from pre-analysed Text (James Clavel's Shogun)
     409          if (textStatisticInput_Digrams == "") textStatisticInput_Digrams = ShogunStatistics.ShogunDigrams;//if Optional Statistical input not used -> use variables from pre-analysed Text (James Clavel's Shogun)
    410410
    411411          double[,] statisticDigramSquare = GetDigramFrequencySquare(StatisticTextFrequencyInput_Digrams);   
     
    496496      public void FastAproach()
    497497      {
    498           if (statisticTextFrequencyInput_Digrams == "") StatisticTextFrequencyInput_Digrams = ShogunStatistics.ShogunDigrams;//if Optional Statistical input not used -> use variables from pre-analysed Text (James Clavel's Shogun)
     498          if (textStatisticInput_Digrams == "") StatisticTextFrequencyInput_Digrams = ShogunStatistics.ShogunDigrams;//if Optional Statistical input not used -> use variables from pre-analysed Text (James Clavel's Shogun)
    499499
    500500          double[,] statisticDigramSquare = GetDigramFrequencySquare(StatisticTextFrequencyInput_Digrams);
  • trunk/CrypPlugins/MonoalphabeticAnalysis/MonoalphabeticAnalysisSettings.cs

    r365 r372  
    2929        /// </summary>
    3030        [PropertySaveOrder(1)]
    31         [ContextMenu("Fast Aproach", "Using Fast Aproach dramatically reduce the time needed as only two decryption attempts are made. ", 7, DisplayLevel.Expert, ContextMenuControlType.ComboBox, null, new string[] { "Don't use Fast Aproach", "Use Fast Aproach" })]
     31        [ContextMenu("Generate Internally", "Using Fast Aproach dramatically reduce the time needed as only two decryption attempts are made. ", 7, DisplayLevel.Expert, ContextMenuControlType.ComboBox, null, new string[] { "Don't use Fast Aproach", "Use Fast Aproach" })]
    3232        [TaskPane("Fast Aproach", "Using Fast Aproach dramatically reduce the time needed as only two decryption attempts are made. ", "", 7, false, DisplayLevel.Expert, ControlType.ComboBox, new string[] { "Don't Use Fast Aproach", "Use Fast Aproach" })]
    3333        public int FastAproach
Note: See TracChangeset for help on using the changeset viewer.