Changeset 1121


Ignore:
Timestamp:
Feb 1, 2010, 10:57:33 PM (12 years ago)
Author:
kohnen
Message:
  • deleted setInput-function from IControlEncryption and all Plugins using IControlEncryption
  • some changes at TranspositionAnalyser plugin & Settings
  • new TranspositionAnalyser sample
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPluginBase/Control/IControlEncryption.cs

    r1095 r1121  
    3131        IControlEncryption clone();
    3232        event KeyPatternChanged keyPatternChanged;
    33        
    34         [Obsolete("Should be passed as parameter in Decrypt(...)/Encrypt(...)")]
    35         void setInput(Object input);
    3633
    3734        [Obsolete("This signature doesn't pass the ciphertext, use Decrypt(byte[], byte[]) instead")]
  • trunk/CrypPlugins/AES/AES.cs

    r1087 r1121  
    708708        }
    709709
    710         public void setInput(Object input) { }
    711710        #region IControlEncryption Members
    712711
  • trunk/CrypPlugins/DES/DES.cs

    r1093 r1121  
    850850        }
    851851
    852         public void setInput(object input)
    853         {
    854             throw new NotImplementedException();
    855         }
    856852
    857853        #endregion
  • trunk/CrypPlugins/SDES/SDES.cs

    r1087 r1121  
    708708
    709709        }
    710         public void setInput(Object input) { }
    711710        #endregion
    712711    }
  • trunk/CrypPlugins/Transposition/Transposition.cs

    r1087 r1121  
    11181118        #region IControlEncryption Member
    11191119
     1120        public void setInput(Object input)
     1121        {
     1122            throw new NotImplementedException();
     1123        }
     1124       
     1125        public byte[] Decrypt(byte[] key, int blocksize)
     1126        {
     1127            throw new NotImplementedException();
     1128        }
     1129
    11201130        public byte[] Decrypt(byte[] ciphertext, byte[] key)
    11211131        {
    1122             throw new NotImplementedException();
    1123         }
    1124 
    1125         public byte[] Decrypt(byte[] key, int blocksize)
    1126         {
     1132            if (plugin.Input == null)
     1133            {
     1134                plugin.Input = ciphertext;
     1135            }
     1136
    11271137            int[] k = new int[key.Length];
    11281138            for(int i=0; i<key.Length; i++)
     
    11531163        {
    11541164            return null;
    1155         }
    1156 
    1157         public void setInput(Object input)
    1158         {
    1159             plugin.Input = (byte[])input;
    11601165        }
    11611166
  • trunk/CrypPlugins/TranspositionAnalyser/TranspositionAnalyser.cs

    r1105 r1121  
    1919
    2020    [Author("Daniel Kohnen, Julian Weyers, Simon Malischewski, Armin Wiefels", "kohnen@cryptool.org, weyers@cryptool.org, malischewski@cryptool.org, wiefels@cryptool.org", "Universität Duisburg-Essen", "http://www.uni-due.de")]
    21     [PluginInfo(true, "Transposition Analyser", "Bruteforces the columnar transposition.", "TranspositionAnalyser/Description/TADescr.xaml" , "TranspositionAnalyser/Images/icon.png")]
     21    [PluginInfo(false, "Transposition Analyser", "Bruteforces the columnar transposition.", "TranspositionAnalyser/Description/TADescr.xaml" , "TranspositionAnalyser/Images/icon.png")]
    2222    public class TranspositionAnalyser : IAnalysisMisc
    2323    {
     
    166166                }
    167167            }
     168            ProgressChanged(1, 1);
    168169        }
    169170
     
    216217            if (input != null)
    217218            {
    218                 sender.setInput(input);
    219219                switch (this.settings.Analysis_method)
    220220                {
     
    292292                list1 = getDummyLinkedList(best);
    293293                String best_text = "";
    294                 byte[] best_bytes = null;
    295294                ArrayList list = null;
    296295
     
    353352                                    b[j] = Convert.ToByte(key[j]);
    354353                                }
    355                                 byte[] dec = sender.Decrypt(b, b.Length);
     354                                byte[] dec = sender.Decrypt(input, b);
    356355                                if (dec != null)
    357356                                {
     
    441440            LinkedList<ValueKey> list = new LinkedList<ValueKey>();
    442441            LinkedListNode<ValueKey> node = list.AddFirst(valueKey);
    443             for (int i = 0; i < 10; i++)
     442            for (int i = 0; i < 9; i++)
    444443            {
    445444                node = list.AddAfter(node, valueKey);
     
    459458                    {
    460459                        node = costList.First;
     460                        int i = 0;
    461461                        while (node != null)
    462462                        {
     
    465465                                costList.AddBefore(node, vk);
    466466                                costList.RemoveLast();
     467                                if (i == 0)
     468                                {
     469                                    Output = vk.decryption;
     470                                }
    467471                               // value_threshold = costList.Last.Value.value;
    468472                                break;
    469473                            }
    470474                            node = node.Next;
     475                            i++;
    471476                        }//end while
    472477                    }//end if
     
    477482                    {
    478483                        node = costList.First;
     484                        int i = 0;
    479485                        while (node != null)
    480486                        {
     
    483489                                costList.AddBefore(node, vk);
    484490                                costList.RemoveLast();
     491                                if (i == 0)
     492                                {
     493                                    Output = vk.decryption;
     494                                }
     495
    485496                               // value_threshold = costList.Last.Value.value;
    486497                                break;
    487498                            }
    488499                            node = node.Next;
     500                            i++;
    489501                        }//end while
    490502                    }//end if
     
    526538        #endregion
    527539
    528         #region KeyLengthAnalysis
     540        #region
    529541
    530542        public ArrayList getKeyLength(byte[] crib, byte[] cipher)
     
    702714                long keystodo = (size - sum);
    703715                long secstodo = keystodo / keysPerSec;
    704                 DateTime endTime = DateTime.Now.AddSeconds(secstodo);
     716               
     717                //dummy Time
     718                DateTime endTime = new DateTime(1970,1,1);
     719                try
     720                {
     721                    endTime = DateTime.Now.AddSeconds(secstodo);
     722                }
     723                catch
     724                {
     725
     726                }
    705727
    706728
     
    710732                    ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).keysPerSecond.Text = "" + keysPerSec;
    711733
    712 
    713                     ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).timeLeft.Text = "" + endTime.Subtract(DateTime.Now);
    714 
    715                     ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).endTime.Text = "" + endTime;
    716                     //((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).listbox.Clear();
     734                    if (endTime != (new DateTime(1970,1,1)))
     735                    {
     736                        ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).timeLeft.Text = "" + endTime.Subtract(DateTime.Now);
     737
     738                        ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).endTime.Text = "" + endTime;
     739                    }
     740                    else
     741                    {
     742                        ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).timeLeft.Text = "incalculable";
     743
     744                        ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).endTime.Text = "in a galaxy far, far away...";
     745                    }
    717746                    linkedListNode = list1.First;
    718747                    ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).listbox.Items.Clear();
     
    721750                    {
    722751                        i++;
    723 
    724                         String dec = System.Text.Encoding.ASCII.GetString(linkedListNode.Value.decryption).Substring(0, 25) + "...";
     752                        String dec = "";
     753                        if (System.Text.Encoding.ASCII.GetString(linkedListNode.Value.decryption).Length > 25)
     754                        {
     755                            dec = System.Text.Encoding.ASCII.GetString(linkedListNode.Value.decryption).Substring(0, 25) + "...";
     756                        }
     757                        else
     758                        {
     759                            dec = System.Text.Encoding.ASCII.GetString(linkedListNode.Value.decryption);
     760                        }
     761                       
    725762                        String key = linkedListNode.Value.key;
    726                         String value = linkedListNode.Value.value + "";
    727                         String outp = i+".:" + key + ":" + dec + "(" + value +")";
     763                        double round = Math.Round(linkedListNode.Value.value, 2);
     764                        String outp = i + ".:" + key + ":" + dec + "(" + round + ")";
    728765                        ((TranspositionAnalyserQuickWatchPresentation)QuickWatchPresentation).listbox.Items.Add(outp);
    729766                        linkedListNode = linkedListNode.Next;
  • trunk/CrypPlugins/TranspositionAnalyser/TranspositionAnalyserSettings.cs

    r1087 r1121  
    7474        private Boolean row_colum_column = true;
    7575        [PropertySaveOrder(3)]
    76         [ContextMenu("Bruteforce Row-Column-Column", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Column", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
    77         [TaskPane("Bruteforce Row-Column-Column", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Column", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
     76        [ContextMenu("R-C-C", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Column", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
     77        [TaskPane("R-C-C", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Column", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
    7878        public bool RowColumnColumn
    7979        {
     
    8989        private Boolean row_colum_row = true;
    9090        [PropertySaveOrder(4)]
    91         [ContextMenu("Bruteforce Row-Column-Row", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Row", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
    92         [TaskPane("Bruteforce Row-Column-Row", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Row", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
     91        [ContextMenu("R-C-R", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Row", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
     92        [TaskPane("R-C-R", "Bruteforce this transposition settings: Read in by row. Permute by column. Read out by Row", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
    9393        public bool RowColumnRow
    9494        {
     
    105105        private Boolean column_colum_row = true;
    106106        [PropertySaveOrder(5)]
    107         [ContextMenu("Bruteforce Column-Column-Row", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by Row", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
    108         [TaskPane("Bruteforce Column-Column-Row", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by Row", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
     107        [ContextMenu("C-C-R", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by Row", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
     108        [TaskPane("C-C-R", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by Row", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
    109109        public bool ColumnColumnRow
    110110        {
     
    120120        private Boolean column_colum_column = true;
    121121        [PropertySaveOrder(6)]
    122         [ContextMenu("Bruteforce Column-Column-Column", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by column", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
    123         [TaskPane("Bruteforce Column-Column-Column", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by column", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
     122        [ContextMenu("C-C-C", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by column", 4, DisplayLevel.Beginner, ContextMenuControlType.CheckBox, null, "Row-Column-Column")]
     123        [TaskPane("C-C-C", "Bruteforce this transposition settings: Read in by column. Permute by column. Read out by column", null, 4, false, DisplayLevel.Expert, ControlType.CheckBox, "")]
    124124        public bool ColumnColumnColumn
    125125        {
Note: See TracChangeset for help on using the changeset viewer.