Ignore:
Timestamp:
Nov 9, 2009, 12:03:29 PM (12 years ago)
Author:
Sören Rinne
Message:
  • slight changes in BerlekampMassey
  • changed CubeAttack, BooleanFunctionParser, Trivium to implement only one Controller interface (IControlGenerateBlackboxOutputBit)
  • modified samples
Location:
trunk/CrypPlugins/Trivium
Files:
2 edited

Legend:

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

    r752 r832  
    1414// for IControl
    1515using Cryptool.PluginBase.Control;
    16 // reference to the TriviumController interface (own dll)
    17 using Cryptool.TriviumController;
     16// reference to the CubeAttackController interface (own dll)
     17using Cryptool.CubeAttackController;
    1818
    1919namespace Cryptool.Trivium
    2020{
    21     [Author("Soeren Rinne, David Oruba & Daehyun Strobel", "soeren.rinne@cryptool.de", "Ruhr-Universitaet Bochum, Chair for Embedded Security (EmSec)", "http://www.trust.ruhr-uni-bochum.de/")]
     21    [Author("Soeren Rinne, David Oruba & Daehyun Strobel", "soeren.rinne@cryptool.org", "Ruhr-Universitaet Bochum, Chair for Embedded Security (EmSec)", "http://www.trust.ruhr-uni-bochum.de/")]
    2222    [PluginInfo(false, "Trivium", "Trivium", "Trivium/DetailedDescription/Description.xaml", "Trivium/icon.png", "Trivium/Images/encrypt.png", "Trivium/Images/decrypt.png")]
    2323    [EncryptionType(EncryptionType.SymmetricBlock)]
     
    678678        #region IControl
    679679
    680         private IControlTrivium triviumSlave;
     680        private IControlCubeAttack triviumSlave;
    681681        [PropertyInfo(Direction.ControlSlave, "Trivium Slave", "Direct access to Trivium.", "", DisplayLevel.Beginner)]
    682         public IControlTrivium TriviumSlave
     682        public IControlCubeAttack TriviumSlave
    683683        {
    684684            get
    685685            {
    686686                if (triviumSlave == null)
    687                     triviumSlave = new TriviumControl(this);
     687                    triviumSlave = new CubeAttackControl(this);
    688688                return triviumSlave;
    689689            }
     
    693693    }
    694694
    695     #region TriviumControl : IControlTrivium
    696 
    697     public class TriviumControl : IControlTrivium
     695    #region TriviumControl : IControlCubeAttack
     696
     697    public class CubeAttackControl : IControlCubeAttack
    698698    {
    699699        public event IControlStatusChangedEventHandler OnStatusChanged;
     
    701701        private TriviumSettings pluginSettings;
    702702
    703         public TriviumControl(Trivium Plugin)
     703        public CubeAttackControl(Trivium Plugin)
    704704        {
    705705            this.plugin = Plugin;
    706706        }
    707707
    708         public TriviumControl(TriviumSettings PluginSettings)
     708        public CubeAttackControl(TriviumSettings PluginSettings)
    709709        {
    710710            this.pluginSettings = PluginSettings;
     
    714714
    715715        // here comes the slave side implementation
    716         public int GenerateTriviumKeystream(int[] IV, int[] key, int length, bool byteSwapping)
     716        /*public int GenerateTriviumKeystream(int[] IV, int[] key, int length, bool byteSwapping)
    717717        {
    718718            string resultString;
     
    732732
    733733            resultString = plugin.keystreamTrivium(length);
     734
     735            return resultInt = Int32.Parse(resultString.Substring(resultString.Length - 1, 1));
     736        }
     737        */
     738
     739        // here comes the slave side implementation
     740        public int GenerateBlackboxOutputBit(object IV, object key, object length)
     741        {
     742            string resultString;
     743            int resultInt;
     744
     745            // convert from object
     746            int[] triviumIV = IV as int[];
     747            int[] triviumKey = key as int[];
     748            int triviumLength = (int)length;
     749
     750            if (triviumKey == null)
     751            {
     752                triviumKey = new int[((TriviumSettings)plugin.Settings).InputKey.Length * 4];
     753                triviumKey = plugin.hextobin(((TriviumSettings)plugin.Settings).InputKey.ToCharArray());
     754                // key = new int[] { 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1 };
     755            }
     756
     757            //plugin.masterSlaveRounds = rounds;
     758            plugin.masterSlaveRounds = ((TriviumSettings)plugin.Settings).InitRounds;
     759            plugin.initTrivium(triviumIV, triviumKey);
     760
     761            resultString = plugin.keystreamTrivium(triviumLength);
    734762
    735763            return resultInt = Int32.Parse(resultString.Substring(resultString.Length - 1, 1));
  • trunk/CrypPlugins/Trivium/Trivium.csproj

    r585 r832  
    7272      <Name>CrypPluginBase</Name>
    7373    </ProjectReference>
    74     <ProjectReference Include="..\TriviumController\TriviumController.csproj">
    75       <Project>{3858B6BC-2680-491F-9022-498A8AC80D7B}</Project>
    76       <Name>TriviumController</Name>
     74    <ProjectReference Include="..\CubeAttackController\CubeAttackController.csproj">
     75      <Project>{2100AC2F-3F2B-48A2-AF42-87EC52C8A703}</Project>
     76      <Name>CubeAttackController</Name>
    7777    </ProjectReference>
    7878  </ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.