Ignore:
Timestamp:
Dec 2, 2008, 2:09:46 PM (13 years ago)
Author:
Danail Vazov
Message:

New Icon added. New setting for Kappa plain-text added.

Location:
trunk/CrypPlugins/FriedmanTest
Files:
3 edited

Legend:

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

    r94 r98  
    101101            if (stringInput != null)
    102102            {
     103                double Kp; //Kappa "plain-text"
     104                //Now we set the Kappa plain-text coefficient. Default is English.
     105                switch (settings.Kappa)
     106                {
     107                    case 1: Kp = 0.0762; break;
     108                    case 2: Kp = 0.0778; break;
     109                    case 3: Kp = 0.0770; break;
     110                    case 4: Kp = 0.0738; break;
     111                    case 5: Kp = 0.0745; break;
     112                    default: Kp = 0.0667; break;
     113                }
    103114                //Edit the input from Frequency Test in order to extract the observed letter frequencies
    104115                string string1 = stringInput;
     
    155166                //OnPropertyChanged("OutputString");
    156167                double Kr = 0.038; //Kappa "random" - expected coincidence rate for a uniform distribution of the alphabet. In this case 1/26, hence we should have a 26 letter alphabet on the input.
    157                 double Kp = 0.065; //Kappa "plain-text"
     168               
    158169                double keyLen = 0.027 * texLen / (((texLen - 1) * obIC) - (Kr * texLen) + Kp);
    159170                stringOutput = Convert.ToString(keyLen);
  • trunk/CrypPlugins/FriedmanTest/FriedmanTestSettings.cs

    r4 r98  
    1111    class FriedmanTestSettings : ISettings
    1212    {
     13
     14        private bool hasChanges = false;
     15        private int kappa = 0; //0="English", 1="German", 2="French", 3="Spanish", 4="Italian",5="Portugeese"
    1316        #region ISettings Members
     17        [ContextMenu("Kappa plain-text", "Select the language to be analysed", 2, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, null, new String[] { "English", "German", "French", "Spanish", "Italian", "Portugeese" })]
     18        [TaskPane("Kappa plain-text", "Select the language to be analysed", null, 2, false, DisplayLevel.Experienced, ControlType.ComboBox, new String[] { "English", "German", "French", "Spanish", "Italian", "Portugeese" })]
     19        public int Kappa
     20        {
     21            get { return this.kappa; }
     22            set
     23            {
     24                if (((int)value) != kappa) hasChanges = true;
     25                this.kappa = (int)value;
     26                OnPropertyChanged("Kappa");
     27            }
     28        }
    1429
    1530        public bool HasChanges
    1631        {
    17             get
     32            get { return hasChanges; }
     33            set { hasChanges = value; }
     34        }
     35        #endregion
     36
     37        #region INotifyPropertyChanged Members
     38
     39        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
     40
     41        protected void OnPropertyChanged(string name)
     42        {
     43            if (PropertyChanged != null)
    1844            {
    19                 return false;
    20                 //throw new NotImplementedException();
    21             }
    22             set
    23             {
    24                 //throw new NotImplementedException();
     45                PropertyChanged(this, new PropertyChangedEventArgs(name));
    2546            }
    2647        }
    2748
    2849        #endregion
    29 
    30         #region INotifyPropertyChanged Members
    31 
    32         public event PropertyChangedEventHandler PropertyChanged;
    33 
    34         #endregion
    3550    }
    3651}
Note: See TracChangeset for help on using the changeset viewer.