Changeset 2062


Ignore:
Timestamp:
Nov 7, 2010, 1:45:50 PM (11 years ago)
Author:
Sven Rech
Message:
  • fixed quadratic sieve time overflow bug
  • fixed substitution case sensitivity behaviors
Location:
trunk
Files:
4 edited

Legend:

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

    r1916 r2062  
    629629            if (msleft > 0 && !double.IsInfinity(msleft))
    630630            {
    631                 TimeSpan ts = new TimeSpan(0, 0, 0, 0, (int)msleft);
     631                TimeSpan ts = new TimeSpan((long)(msleft * TimeSpan.TicksPerMillisecond));
    632632                timeLeft_message = timeSpanString(ts) + " left";
    633633                endtime_message = "" + now.AddMilliseconds((long)msleft);
  • trunk/CrypPlugins/Substitution/Substitution.cs

    r1259 r2062  
    5151        public Substitution()
    5252        {
    53             this.settings = new SubstitutionSettings();
     53            this.settings = new SubstitutionSettings(this);
    5454            ((SubstitutionSettings)(this.settings)).LogMessage += Substitution_LogMessage;
    5555        }
     
    313313        #endregion
    314314
     315        public void GuiLogMessage(string message, NotificationLevel loglevel)
     316        {
     317            if (OnGuiLogNotificationOccured != null)
     318                OnGuiLogNotificationOccured(this, new GuiLogEventArgs(message, this, loglevel));
     319        }
     320
    315321        #region IPlugin members
    316322
     
    402408        public void Execute()
    403409        {
     410            foreach (char c in settings.KeyValue)
     411            {
     412                if (!settings.AlphabetSymbols.Contains(c))
     413                {
     414                    GuiLogMessage("Key contains characters that are not part of the alphabet!", NotificationLevel.Error);
     415                    return;
     416                }
     417            }
     418
    404419            switch (settings.Action)
    405420            {
  • trunk/CrypPlugins/Substitution/SubstitutionSettings.cs

    r1260 r2062  
    9191        private UnknownSymbolHandlingMode unknowSymbolHandling = UnknownSymbolHandlingMode.Ignore;
    9292        private int caseSensitiveAlphabet = 0; //0=case insensitive, 1 = case sensitive
    93 
    94         #endregion
     93        private Substitution substitution;
     94
     95        #endregion
     96
     97        public SubstitutionSettings(Substitution substitution)
     98        {
     99            this.substitution = substitution;
     100        }
    95101
    96102        #region Private methods
     
    118124        private void setCipherAlphabet(string value)
    119125        {
     126            foreach (char c in value)
     127            {
     128                if (!alphabet.Contains(c))
     129                    substitution.GuiLogMessage("Key contains characters that are not part of the alphabet!", NotificationLevel.Error);
     130            }
     131
    120132            try
    121133            {
     
    198210            get { return this.keyValue; }
    199211            set
    200             { 
     212            {
    201213                this.keyValue = value;
    202214                setCipherAlphabet(keyValue);
Note: See TracChangeset for help on using the changeset viewer.