Changeset 304 for trunk/CrypPlugins/CLK


Ignore:
Timestamp:
May 6, 2009, 6:27:10 PM (13 years ago)
Author:
Sören Rinne
Message:
  • added some AND plugin icons
  • added Berlekamp-Massey algorithm plugin (computes polynomial C(D) for a LFSR with minimal length L from given output stream of an unknown LFSR)
  • modified BoolComparator, CLK, LFSR, Majority and XORBinary plugins
Location:
trunk/CrypPlugins/CLK
Files:
2 edited

Legend:

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

    r289 r304  
    2121    # region private variables
    2222    private bool output;
     23    private bool eventInput;
    2324    private int timeout = 2000;
    2425    private int rounds = 10;
     
    2728
    2829    public int myRounds;
     30    public DateTime startTime;
    2931
    3032    public CLK()
     
    7476    }
    7577
     78    [PropertyInfo(Direction.Input, "EventInput", "EventInput", "", false, false, DisplayLevel.Beginner, QuickWatchFormat.Text, null)]
     79    public bool EventInput
     80    {
     81        get { return eventInput; }
     82        set
     83        {
     84            eventInput = value;
     85            OnPropertyChanged("EventInput");
     86        }
     87    }
     88
    7689
    7790    # endregion public interface
     
    104117        myRounds = settings.Rounds;
    105118        GuiLogMessage("myRounds: " + myRounds.ToString(), NotificationLevel.Info);
     119
     120        startTime = DateTime.Now;
    106121    }
    107122
    108123    public void Execute()
    109124    {
    110         if (settings.CLKTimeout <= 499)
    111         {
    112             GuiLogMessage("Are you trying to generate bulk output? Please do not use CLK plugin for this purpose. Try setting the number of rounds in the corresponding plugin settings.", NotificationLevel.Warning);
     125        if (settings.UseEvent)
     126        {
     127            if (myRounds != 0)
     128            {
     129                OnPropertyChanged("Output");
     130                myRounds--;
     131            }
     132            else
     133            {
     134                // stop counter
     135                DateTime stopTime = DateTime.Now;
     136                // compute overall time
     137                TimeSpan duration = stopTime - startTime;
     138                GuiLogMessage("Overall time used: " + duration, NotificationLevel.Info);
     139            }
    113140        }
    114141        else
    115142        {
    116             process(settings.CLKTimeout);
    117             //change picture
    118             if (settings.SetClockToTrue) StatusChanged((int)CLKImage.True);
    119             else StatusChanged((int)CLKImage.False);
    120         }
    121        
     143            if (settings.CLKTimeout <= 499)
     144            {
     145                GuiLogMessage("Are you trying to generate bulk output? Please do not use CLK plugin for this purpose. Try setting the number of rounds in the corresponding plugin settings.", NotificationLevel.Warning);
     146            }
     147            else
     148            {
     149                process(settings.CLKTimeout);
     150                //change picture
     151                if (settings.SetClockToTrue) StatusChanged((int)CLKImage.True);
     152                else StatusChanged((int)CLKImage.False);
     153            }
     154        }
    122155    }
    123156
  • trunk/CrypPlugins/CLK/CLKSettings.cs

    r288 r304  
    1414    private bool hasChanges = false;
    1515    private bool setClockToTrue = true;
     16    private bool useEvent = false;
    1617    private int clkTimeout = 2000;
    1718    # endregion private variables
     
    6970    }
    7071
     72    [ContextMenu("Use input event instead of clock", " yes / no ", 0, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Use input event instead of clock")]
     73    [TaskPaneAttribute("Use input event instead of clock", " yes / no ", "", 0, true, DisplayLevel.Beginner, ControlType.CheckBox, null)]
     74    public bool UseEvent
     75    {
     76        get { return this.useEvent; }
     77        set
     78        {
     79            this.useEvent = value;
     80            OnPropertyChanged("UseEvent");
     81            HasChanges = true;
     82        }
     83
     84    }
     85
    7186    private int rounds = 10; //how many bits will be generated
    7287    //[ContextMenu("Rounds", "How many bits shall be generated?", 1, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, new int[] { 10, 50, 100 }, "10 bits", "50 bits", "100 bits")]
Note: See TracChangeset for help on using the changeset viewer.