Changeset 8159


Ignore:
Timestamp:
Jun 7, 2019, 10:54:03 AM (3 years ago)
Author:
Christian Bender
Message:

DCAKeyRecovery: initial commit
DCAOracle: implementation change
DCAPathVisualiser: initial commit
ToyCipher: UI fix

Location:
trunk
Files:
32 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPluginsExperimental/DCAOracle/DCAOracle.cs

    r8156 r8159  
    2020using System.Windows.Controls;
    2121using Cryptool.PluginBase;
     22using Cryptool.PluginBase.IO;
    2223using Cryptool.PluginBase.Miscellaneous;
    2324using DCAOracle;
     25using DCAOracle.Properties;
     26
    2427
    2528namespace Cryptool.Plugins.DCAOracle
     
    3639        private int _messsageDifference;
    3740        private int _messagePairsCount;
    38         private byte[] _messagePairsOutput;
     41        private ICryptoolStream _messagePairsOutput;
    3942
    4043        #endregion
     
    7477        /// </summary>
    7578        [PropertyInfo(Direction.OutputData, "MessagePairsOutput", "MessagePairsOutputToolTip")]
    76         public byte[] MessagePairsOutput
     79        public ICryptoolStream MessagePairsOutput
    7780        {
    7881            get { return _messagePairsOutput; }
     
    118121            if (MessagePairsCount == 0)
    119122            {
    120                 GuiLogMessage(, NotificationLevel.Warning)
     123                GuiLogMessage(Resources.WarningMessageCountMustBeSpecified, NotificationLevel.Warning);
    121124                return;
    122125            }
     
    132135            for (i = 0; i < MessagePairsCount; i++)
    133136            {
    134                 int x = _random.Next(0, ((int) Math.Pow(2, _settings.WordSize) - 1));
    135                 int y = x ^ MessageDifference;
     137                int xtemp = _random.Next(0, ((int)Math.Pow(2, _settings.WordSize) - 1));
     138                int ytemp = xtemp ^ MessageDifference;
     139
     140                UInt16 x = (UInt16)xtemp;
     141                UInt16 y = (UInt16)ytemp;
    136142
    137143                Pair inputPair = new Pair()
     
    147153            }
    148154
    149             //each pair consists of 2 int32 and each int32 consists of 4 byte
    150             _messagePairsOutput = new byte[MessagePairsCount * 2 * 4];
     155            //each pair consists of 2 uint16 and each uint16 consists of 2 byte
     156            byte[] outputTemp = new byte[MessagePairsCount * 2 * 2];
    151157
    152158            //convert pairs
     
    155161            {
    156162                byte[] leftMember = BitConverter.GetBytes(curPair.LeftMember);
    157                 _messagePairsOutput[i] = leftMember[0];
    158                 _messagePairsOutput[i + 1] = leftMember[1];
    159                 _messagePairsOutput[i + 2] = leftMember[2];
    160                 _messagePairsOutput[i + 3] = leftMember[3];
     163                outputTemp[i] = leftMember[0];
     164                outputTemp[i + 1] = leftMember[1];
    161165
    162166                byte[] rightMember = BitConverter.GetBytes(curPair.RightMember);
    163                 _messagePairsOutput[i + 4] = rightMember[0];
    164                 _messagePairsOutput[i + 5] = rightMember[1];
    165                 _messagePairsOutput[i + 6] = rightMember[2];
    166                 _messagePairsOutput[i + 7] = rightMember[3];
    167 
    168                 i += 8;
     167                outputTemp[i + 2] = rightMember[0];
     168                outputTemp[i + 3] = rightMember[1];
     169
     170                i += 4;
    169171                curProgress += stepCount;
    170172                ProgressChanged(curProgress, 1);
     173            }
     174
     175            //write all messages to the output
     176            using (CStreamWriter writer = new CStreamWriter())
     177            {
     178                writer.Write(outputTemp, 0, outputTemp.Length);
     179                writer.Flush();
     180                MessagePairsOutput = writer;
    171181            }
    172182
  • trunk/CrypPluginsExperimental/DCAOracle/Pair.cs

    r8156 r8159  
    2121    public class Pair : ICloneable
    2222    {
    23         public int LeftMember;
    24         public int RightMember;
     23        public UInt16 LeftMember;
     24        public UInt16 RightMember;
    2525
    2626        public Pair()
     
    3030        }
    3131
    32         public Pair(int leftMember, int rightMember)
     32        public Pair(UInt16 leftMember, UInt16 rightMember)
    3333        {
    3434            LeftMember = leftMember;
  • trunk/CrypPluginsExperimental/DCAOracle/Properties/Resources.Designer.cs

    r8156 r8159  
    143143       
    144144        /// <summary>
    145         ///   Sucht eine lokalisierte Zeichenfolge, die word length ähnelt.
     145        ///   Sucht eine lokalisierte Zeichenfolge, die Blocksize ähnelt.
    146146        /// </summary>
    147147        internal static string WorSizeParameter {
     
    152152       
    153153        /// <summary>
    154         ///   Sucht eine lokalisierte Zeichenfolge, die This parameter specifies the word width of the messages to be generated ähnelt.
     154        ///   Sucht eine lokalisierte Zeichenfolge, die This parameter specifies the blocksize of the used cipher. Each message will contain exactly one block. ähnelt.
    155155        /// </summary>
    156156        internal static string WorSizeParameterToolTip {
  • trunk/CrypPluginsExperimental/DCAOracle/Properties/Resources.de.resx

    r8156 r8159  
    146146  </data>
    147147  <data name="WorSizeParameter" xml:space="preserve">
    148     <value>Wortbreite</value>
     148    <value>Blockgröße</value>
    149149  </data>
    150150  <data name="WorSizeParameterToolTip" xml:space="preserve">
    151     <value>Dieser Parameter spezifiziert die Wortbreite der zu generierenden Nachrichten</value>
     151    <value>Dieser Parameter gibt die Blockgröße der verwendeten Chiffre an. Jede Nachricht enthält genau einen Block.</value>
    152152  </data>
    153153</root>
  • trunk/CrypPluginsExperimental/DCAOracle/Properties/Resources.resx

    r8156 r8159  
    146146  </data>
    147147  <data name="WorSizeParameter" xml:space="preserve">
    148     <value>word length</value>
     148    <value>Blocksize</value>
    149149  </data>
    150150  <data name="WorSizeParameterToolTip" xml:space="preserve">
    151     <value>This parameter specifies the word width of the messages to be generated</value>
     151    <value>This parameter specifies the blocksize of the used cipher. Each message will contain exactly one block.</value>
    152152  </data>
    153153</root>
  • trunk/CrypPluginsExperimental/DCAPathFinder/Algorithms.cs

    r8137 r8159  
    1 using System;
     1/*
     2   Copyright 2019 Christian Bender christian1.bender@student.uni-siegen.de
     3
     4   Licensed under the Apache License, Version 2.0 (the "License");
     5   you may not use this file except in compliance with the License.
     6   You may obtain a copy of the License at
     7
     8       http://www.apache.org/licenses/LICENSE-2.0
     9
     10   Unless required by applicable law or agreed to in writing, software
     11   distributed under the License is distributed on an "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13   See the License for the specific language governing permissions and
     14   limitations under the License.
     15*/
     16
     17using System;
    218using System.Collections.Generic;
    319using System.Linq;
  • trunk/CrypPluginsExperimental/DCAPathFinder/DCAPathFinderSettings.cs

    r8152 r8159  
    6363        /// Selection of the toy cipher algorithm
    6464        /// </summary>
    65         [TaskPane("ChoiceOfAlgorithm", "ChoiceOfAlgorithmToolTop", null, 2, false, ControlType.ComboBox, new string[] { "Cipher1", "Cipher2", "Cipher3", "Cipher4" })]
     65        [TaskPane("ChoiceOfAlgorithm", "ChoiceOfAlgorithmToolTop", null, 2, false, ControlType.ComboBox, new string[] { "Cipher1", "Cipher2", "Cipher3"})]
    6666        public string ChoiceOfAlgorithm
    6767        {
  • trunk/CrypPluginsExperimental/DCAPathFinder/Properties/Resources.Designer.cs

    r8156 r8159  
    7171       
    7272        /// <summary>
    73         ///   Sucht eine lokalisierte Zeichenfolge, die Choice of the algorithm ähnelt.
     73        ///   Sucht eine lokalisierte Zeichenfolge, die Choice of the cipher ähnelt.
    7474        /// </summary>
    7575        internal static string ChoiceOfAlgorithm {
     
    8080       
    8181        /// <summary>
    82         ///   Sucht eine lokalisierte Zeichenfolge, die At this point one of the algorithms contained in the list can be selected. This algorithm can be examined by differential cryptanalysis. ähnelt.
     82        ///   Sucht eine lokalisierte Zeichenfolge, die At this point one of the ciphers contained in the list can be selected. This cipher can be examined by differential cryptanalysis. ähnelt.
    8383        /// </summary>
    8484        internal static string ChoiceOfAlgorithmToolTop {
  • trunk/CrypPluginsExperimental/DCAPathFinder/Properties/Resources.de.resx

    r8156 r8159  
    122122  </data>
    123123  <data name="ChoiceOfAlgorithm" xml:space="preserve">
    124     <value>Wahl des Algorithmus</value>
     124    <value>Wahl der Chiffre</value>
    125125  </data>
    126126  <data name="ChoiceOfAlgorithmToolTop" xml:space="preserve">
    127     <value>An dieser Stelle kann einer der in der Liste enthaltenen Algorithmen ausgewählt werden. Dieser kann mittels differenzieller Kryptoanalyse untersucht werden.</value>
     127    <value>An dieser Stelle kann eine der in der Liste enthaltenen Chiffren ausgewählt werden. Diese kann mittels differenzieller Kryptoanalyse untersucht werden.</value>
    128128  </data>
    129129  <data name="Cipher1" xml:space="preserve">
  • trunk/CrypPluginsExperimental/DCAPathFinder/Properties/Resources.resx

    r8156 r8159  
    122122  </data>
    123123  <data name="ChoiceOfAlgorithm" xml:space="preserve">
    124     <value>Choice of the algorithm</value>
     124    <value>Choice of the cipher</value>
    125125  </data>
    126126  <data name="ChoiceOfAlgorithmToolTop" xml:space="preserve">
    127     <value>At this point one of the algorithms contained in the list can be selected. This algorithm can be examined by differential cryptanalysis.</value>
     127    <value>At this point one of the ciphers contained in the list can be selected. This cipher can be examined by differential cryptanalysis.</value>
    128128  </data>
    129129  <data name="Cipher1" xml:space="preserve">
  • trunk/CrypPluginsExperimental/ToyCiphers/UI/Cipher1Pres.xaml

    r8136 r8159  
    4040                </Grid.RowDefinitions>
    4141
    42                 <Label Grid.Row="0" FontFamily="Courier New" FontSize="30" FontWeight="Bold" Content="{Loc Cipher1LblHeading}" HorizontalAlignment="Center"/>
    43                 <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" Margin="10,0,10,0" Text="{Loc Cipher1LblText}" TextWrapping="Wrap"></TextBlock>
     42                <Label Grid.Row="0" FontFamily="Courier New" FontSize="20" FontWeight="Bold" Content="{Loc Cipher1LblHeading}" HorizontalAlignment="Center"/>
     43                <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" Margin="10,0,10,0" Text="{Loc Cipher1LblText}" TextWrapping="Wrap"></TextBlock>
    4444
    4545                <Grid Grid.Row="2">
     
    4949                        <RowDefinition Height="Auto"></RowDefinition>
    5050                    </Grid.RowDefinitions>
    51                     <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="15" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
    52                     <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
     51                    <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="12" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
     52                    <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
    5353                    <DataGrid Grid.Row="2" HorizontalAlignment="Center" CanUserAddRows="false" AutoGenerateColumns="False" Margin="0,10,0,0" ItemsSource="{Binding SBoxData, Mode=OneWay}">
    5454                        <DataGrid.Columns >
  • trunk/CrypPluginsExperimental/ToyCiphers/UI/Cipher2Pres.xaml

    r8136 r8159  
    6262                    <RowDefinition Height="Auto"></RowDefinition>
    6363                </Grid.RowDefinitions>
    64                 <Label Grid.Row="0" FontFamily="Courier New" FontSize="30" FontWeight="Bold" Content="{Loc Cipher2LblHeading}" HorizontalAlignment="Center"/>
    65                 <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" Margin="10,0,10,0" Text="{Loc Cipher2LblText}" TextWrapping="Wrap"></TextBlock>
     64                <Label Grid.Row="0" FontFamily="Courier New" FontSize="20" FontWeight="Bold" Content="{Loc Cipher2LblHeading}" HorizontalAlignment="Center"/>
     65                <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" Margin="10,0,10,0" Text="{Loc Cipher2LblText}" TextWrapping="Wrap"></TextBlock>
    6666
    6767                <Grid Grid.Row="2">
     
    7171                        <RowDefinition Height="Auto"></RowDefinition>
    7272                    </Grid.RowDefinitions>
    73                     <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="15" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
    74                     <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
     73                    <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="12" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
     74                    <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
    7575                    <DataGrid Grid.Row="2" HorizontalAlignment="Center" CanUserAddRows="false" AutoGenerateColumns="False" Margin="0,10,0,0" ItemsSource="{Binding SBoxData, Mode=OneWay}">
    7676                        <DataGrid.Columns >
     
    102102                        <RowDefinition Height="Auto"></RowDefinition>
    103103                    </Grid.RowDefinitions>
    104                     <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="15" Margin="10,10,10,0" Text="{Loc DescPermutation}" TextWrapping="Wrap"></TextBlock>
    105                     <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderPermutation}" TextWrapping="Wrap"></TextBlock>
     104                    <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="12" Margin="10,10,10,0" Text="{Loc DescPermutation}" TextWrapping="Wrap"></TextBlock>
     105                    <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderPermutation}" TextWrapping="Wrap"></TextBlock>
    106106                    <DataGrid Grid.Row="2" HorizontalAlignment="Center" CanUserAddRows="false" AutoGenerateColumns="False" Margin="0,10,0,0" ItemsSource="{Binding PermutationData, Mode=OneWay}">
    107107                        <DataGrid.Columns >
  • trunk/CrypPluginsExperimental/ToyCiphers/UI/Cipher3Pres.xaml

    r8136 r8159  
    8383                </Grid.RowDefinitions>
    8484
    85                 <Label Grid.Row="0" FontFamily="Courier New" FontSize="30" FontWeight="Bold" Content="{Loc Cipher3LblHeading}" HorizontalAlignment="Center"/>
    86                 <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" Margin="10,0,10,0" Text="{Loc Cipher3LblText}" TextWrapping="Wrap"></TextBlock>
     85                <Label Grid.Row="0" FontFamily="Courier New" FontSize="20" FontWeight="Bold" Content="{Loc Cipher3LblHeading}" HorizontalAlignment="Center"/>
     86                <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" Margin="10,0,10,0" Text="{Loc Cipher3LblText}" TextWrapping="Wrap"></TextBlock>
    8787
    8888                <Grid Grid.Row="2">
     
    9292                        <RowDefinition Height="Auto"></RowDefinition>
    9393                    </Grid.RowDefinitions>
    94                     <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="15" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
    95                     <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
     94                    <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="12" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
     95                    <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
    9696                    <DataGrid Grid.Row="2" HorizontalAlignment="Center" CanUserAddRows="false" AutoGenerateColumns="False" Margin="0,10,0,0" ItemsSource="{Binding SBoxData, Mode=OneWay}">
    9797                        <DataGrid.Columns >
     
    123123                        <RowDefinition Height="Auto"></RowDefinition>
    124124                    </Grid.RowDefinitions>
    125                     <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="15" Margin="10,10,10,0" Text="{Loc DescPermutation}" TextWrapping="Wrap"></TextBlock>
    126                     <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderPermutation}" TextWrapping="Wrap"></TextBlock>
     125                    <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="12" Margin="10,10,10,0" Text="{Loc DescPermutation}" TextWrapping="Wrap"></TextBlock>
     126                    <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderPermutation}" TextWrapping="Wrap"></TextBlock>
    127127                    <DataGrid Grid.Row="2" HorizontalAlignment="Center" CanUserAddRows="false" AutoGenerateColumns="False" Margin="0,10,0,0" ItemsSource="{Binding PermutationData, Mode=OneWay}">
    128128                        <DataGrid.Columns >
  • trunk/CrypPluginsExperimental/ToyCiphers/UI/Cipher4Pres.xaml

    r8136 r8159  
    5151                </Grid.RowDefinitions>
    5252
    53                 <Label Grid.Row="0" FontFamily="Courier New" FontSize="30" FontWeight="Bold" Content="{Loc Cipher4LblHeading}" HorizontalAlignment="Center"/>
    54                 <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" Margin="10,0,10,0" Text="{Loc Cipher4LblText}" TextWrapping="Wrap"></TextBlock>
     53                <Label Grid.Row="0" FontFamily="Courier New" FontSize="20" FontWeight="Bold" Content="{Loc Cipher4LblHeading}" HorizontalAlignment="Center"/>
     54                <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" Margin="10,0,10,0" Text="{Loc Cipher4LblText}" TextWrapping="Wrap"></TextBlock>
    5555
    5656                <Grid Grid.Row="2">
     
    6060                        <RowDefinition Height="Auto"></RowDefinition>
    6161                    </Grid.RowDefinitions>
    62                     <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="15" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
    63                     <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="15" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
     62                    <TextBlock Grid.Row="0" FontFamily="Courier New" FontSize="12" Margin="10,10,10,0" Text="{Loc DescSBox}" TextWrapping="Wrap"></TextBlock>
     63                    <TextBlock Grid.Row="1" FontFamily="Courier New" FontSize="12" FontWeight="Bold" Margin="10,10,10,0" Text="{Loc HeaderSBox}" TextWrapping="Wrap"></TextBlock>
    6464                    <DataGrid Grid.Row="2" HorizontalAlignment="Center" CanUserAddRows="false" AutoGenerateColumns="False" Margin="0,10,0,0" ItemsSource="{Binding SBoxData, Mode=OneWay}">
    6565                        <DataGrid.Columns >
  • trunk/CrypPluginsExperimental/ToyCiphers/UI/ToyCiphersPres.xaml

    r8126 r8159  
    66             xmlns:local="clr-namespace:ToyCiphers.UI"
    77             mc:Ignorable="d"
    8              d:DesignHeight="450" d:DesignWidth="800">
     8             d:DesignHeight="415" d:DesignWidth="540">
    99
    1010    <Grid Name="MainGrid">
  • trunk/Templates/Experimental/Differential_Cryptanalysis.xml

    r8154 r8159  
    2525        <replacement key="$DCADesc$" value="This template contains a tutorial for differential cryptanalysis of symmetric block ciphers." />
    2626        <replacement key="$DCAPathFinderComponent$" value="DCA PfadFinder" />
    27                 <replacement key="$DCAOracleComponent$" value="DCA Orakel" />
     27        <replacement key="$DCAOracleComponent$" value="DCA Orakel" />
     28        <replacement key="$DCAKeyRecoveryComponent$" value="DCA Schlüsselwiederherstelung" />
     29        <replacement key="$DCAPathVisualiserComponent$" value="DCA PfadVisualisierer" />
    2830  </replacements>
    2931  <replacements lang="en">
     
    3537        <replacement key="$DCAPathFinderComponent$" value="DCA PathFinder" />
    3638        <replacement key="$DCAOracleComponent$" value="DCA Oracle" />
     39        <replacement key="$DCAKeyRecoveryComponent$" value="DCA KeyRecovery" />
     40        <replacement key="$DCAPathVisualiserComponent$" value="DCA PathVisualiser" />
    3741  </replacements>
    3842</sample>
Note: See TracChangeset for help on using the changeset viewer.