Changeset 446


Ignore:
Timestamp:
Aug 31, 2009, 2:09:07 PM (12 years ago)
Author:
Sören Rinne
Message:
  • added Cube Attack (by David Oruba) on Trivium
  • added M/S Controller to Cube Attack and BooleanFunctionParser (until now only producing dummy output)
Location:
trunk/CrypPlugins
Files:
21 added
2 edited

Legend:

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

    r430 r446  
    1616// for RegEx
    1717using System.Text.RegularExpressions;
     18// for IControl
     19using Cryptool.PluginBase.Control;
     20// reference to the BFPController interface
     21using Cryptool.BooleanFunctionParserController;
    1822
    1923namespace BooleanFunctionParser
     
    284288         * ***********************************************************************
    285289        */
    286         private bool ParseBooleanFunction(string function, bool[] inputVariables)
     290        public bool ParseBooleanFunction(string function, bool[] inputVariables)
    287291        {
    288292            // TODO: call ReplaceVariables with a bool[]
    289             return true;
     293            // this dummy function just returns the first value of the data[] array
     294            return inputVariables[0];
    290295        }
    291296
     
    676681
    677682        #endregion
     683
     684        #region IControl
     685
     686        private IControlSolveFunction testSlave;
     687        [PropertyInfo(Direction.ControlSlave, "BFP Slave", "Direct access to BFP.", "", DisplayLevel.Beginner)]
     688        public IControlSolveFunction TestSlave
     689        {
     690            get
     691            {
     692                if (testSlave == null)
     693                    testSlave = new BFPControl(this);
     694                return testSlave;
     695            }
     696        }   
     697        #endregion
    678698    }
    679699
     
    742762    }
    743763*/
     764   
     765    public class BFPControl : IControlSolveFunction
     766    {
     767        private BooleanFunctionParser plugin;
     768
     769        public BFPControl(BooleanFunctionParser Plugin)
     770        {
     771            this.plugin = Plugin;
     772        }
     773
     774        #region IControlEncryption Members
     775
     776        // here comes the slave side implementation of SolveFunction
     777        public int SolveFunction(string function, bool[] data)
     778        {
     779            bool resultBool;
     780            int resultInt;
     781
     782            // the result is computed by calling the ParseBooleanFunction (step into it with F11)
     783            resultBool = plugin.ParseBooleanFunction(function, data);
     784            // the result is converted into an integer
     785            resultInt = Convert.ToInt32(resultBool);
     786            return resultInt;
     787        }
     788
     789        #endregion
     790    }
    744791}
  • trunk/CrypPlugins/BooleanFunctionParser/BooleanFunctionParser.csproj

    r331 r446  
    3434  </PropertyGroup>
    3535  <ItemGroup>
     36    <Reference Include="BooleanFunctionParserController, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6ffa0264846191ab, processorArchitecture=MSIL">
     37      <SpecificVersion>False</SpecificVersion>
     38      <HintPath>..\BooleanFunctionParserController\bin\Debug\BooleanFunctionParserController.dll</HintPath>
     39    </Reference>
    3640    <Reference Include="CrypPluginBase, Version=2.0.3410.1, Culture=neutral, PublicKeyToken=db26bd0a20dcbd5c, processorArchitecture=MSIL">
    3741      <SpecificVersion>False</SpecificVersion>
Note: See TracChangeset for help on using the changeset viewer.