Changeset 566


Ignore:
Timestamp:
Sep 23, 2009, 4:28:57 PM (12 years ago)
Author:
Matthäus Wander
Message:

CrypPluginBase:

  • fixed bug in Tokenizer which had impact on EnigmaAnalyzer

EnigmaAnalyzer:

  • reverted buggy print-loop (lead to exception when there were less entries than expected)
  • updated file format to current settings file

FrequencyTest:

  • enlarged lock-block (otherwise an exception in ElementAt(...) occured sometimes in EnigmaAnalyzer samples)
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPluginBase/Miscellaneous/Tokenizer.cs

    r510 r566  
    261261        public static IEnumerable<string> tokenize(string word, int gramLength, bool includeFragments)
    262262        {
    263             return new GramTokenizer(word, 1, includeFragments);
     263            return new GramTokenizer(word, gramLength, includeFragments);
    264264        }
    265265
  • trunk/CrypPlugins/Enigma/EnigmaAnalyzer.cs

    r557 r566  
    5858        private List<analysisConfigSettings> analysisCandidates = new List<analysisConfigSettings>();
    5959        private const int maxAnalysisEntries = 10; // should go in settings under "Analysis Options"
    60         private const int maxPrintedCandidates = 10; // should go in settings under "Analysis Options"
    6160
    6261        #endregion
     
    686685            message.AppendLine("=====================================");
    687686
    688             for (int i = 0; i < maxPrintedCandidates; i++)
    689             {
    690                 analysisConfigSettings cfg = analysisCandidates[maxAnalysisEntries - i - 1];
     687            foreach (analysisConfigSettings cfg in analysisCandidates)
     688            {
    691689                message.AppendFormat("{0} | {1},{2},{3} | {4},{5},{6} | {7} | {8}" + Environment.NewLine,
    692690                    cfg.Score.ToString(),
  • trunk/CrypPlugins/FrequencyTest/FrequencyTest.cs

    r510 r566  
    166166                    g[SINKOV] = Math.Log(g[PERCENTAGED], Math.E);
    167167                }
    168             }
    169 
    170             double max = grams.Values.Max(item => item[PERCENTAGED]);
    171             GuiLogMessage("Max n-gram percentage is: " + max, NotificationLevel.Debug);
    172 
    173             // calculate presentation bars height
    174             foreach (KeyValuePair<string, double[]> item in grams)
    175             {
    176                 int height = (int) (item.Value[PERCENTAGED] * (160 / max));
    177                 CollectionElement row = new CollectionElement(height, Math.Round(item.Value[PERCENTAGED] * 100, 3), item.Key);
    178                 data.ValueCollection.Add(row);
    179             }
    180 
    181             // OUTPUT
    182             StringBuilder sb = new StringBuilder();
    183             arrayOutput = new int[grams.Count];
    184             for (int i = 0; i < grams.Count; i++)
    185             {
    186                 KeyValuePair<string, double[]> item = grams.ElementAt(i);
    187 
    188                 sb.Append(item.Key + ":");
    189                 sb.Append(item.Value[ABSOLUTE] + ":");
    190                 sb.Append(Math.Round(item.Value[PERCENTAGED] * 100, 3) + Environment.NewLine);
    191 
    192                 arrayOutput[i] = (int) item.Value[ABSOLUTE];
    193             }
    194             stringOutput = sb.ToString();
     168
     169                double max = grams.Values.Max(item => item[PERCENTAGED]);
     170                GuiLogMessage("Max n-gram percentage is: " + max, NotificationLevel.Debug);
     171
     172                // calculate presentation bars height
     173                foreach (KeyValuePair<string, double[]> item in grams)
     174                {
     175                    int height = (int)(item.Value[PERCENTAGED] * (160 / max));
     176                    CollectionElement row = new CollectionElement(height, Math.Round(item.Value[PERCENTAGED] * 100, 3), item.Key);
     177                    data.ValueCollection.Add(row);
     178                }
     179
     180                // OUTPUT
     181                StringBuilder sb = new StringBuilder();
     182                arrayOutput = new int[grams.Count];
     183                for (int i = 0; i < grams.Count; i++)
     184                {
     185                    KeyValuePair<string, double[]> item = grams.ElementAt(i);
     186
     187                    sb.Append(item.Key + ":");
     188                    sb.Append(item.Value[ABSOLUTE] + ":");
     189                    sb.Append(Math.Round(item.Value[PERCENTAGED] * 100, 3) + Environment.NewLine);
     190
     191                    arrayOutput[i] = (int)item.Value[ABSOLUTE];
     192                }
     193                stringOutput = sb.ToString();
     194            }
    195195
    196196            OnPropertyChanged("StringOutput");
Note: See TracChangeset for help on using the changeset viewer.