Changeset 809


Ignore:
Timestamp:
Nov 1, 2009, 11:29:05 AM (12 years ago)
Author:
Timo Eckhardt
Message:

switched from GmpBigInteger to PrimesBigInteger based on BouncyCastle BigInteger

Location:
trunk/CrypPlugins
Files:
4 edited

Legend:

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

    r419 r809  
    55using Cryptool.PluginBase.Tool;
    66using Cryptool.PluginBase;
    7 using LibGmpWrapper;
    87using Cryptool.PluginBase.IO;
     8using Primes.Bignum;
    99
    1010namespace PrimeTest
     
    9999    #region Properties
    100100    private string m_InputString;
    101     GmpBigInteger m_Value = null;
     101    PrimesBigInteger m_Value = null;
    102102    [PropertyInfo(Direction.InputData, "Text input", "Input a string that represent a natural number", "", true, false, DisplayLevel.Beginner, QuickWatchFormat.Text,null)]
    103103    public string InputString
     
    113113            {
    114114              this.m_InputString = value;
    115               m_Value = new GmpBigInteger(m_InputString.Trim());
     115              m_Value = new PrimesBigInteger(m_InputString.Trim());
    116116              FirePropertyChangeEvent("InputString");
    117117            }
  • trunk/CrypPlugins/PrimeTest/PrimeTest.csproj

    r4 r809  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    6     <ProductVersion>9.0.21022</ProductVersion>
     6    <ProductVersion>9.0.30729</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    88    <ProjectGuid>{A91DE3E2-DF16-42E1-B164-7B02F4B2665F}</ProjectGuid>
     
    3232  </PropertyGroup>
    3333  <ItemGroup>
    34     <Reference Include="LibGmpWrapper, Version=1.0.2987.28787, Culture=neutral, processorArchitecture=x86">
    35       <SpecificVersion>False</SpecificVersion>
    36       <HintPath>..\Primes\Primes.References\LibGmpWrapper.dll</HintPath>
    37     </Reference>
    3834    <Reference Include="PresentationCore">
    3935      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     
    6864      <Name>CrypPluginBase</Name>
    6965    </ProjectReference>
     66    <ProjectReference Include="..\Primes\Primes\Primes.csproj">
     67      <Project>{2830F337-A7A3-4A68-87AC-64F3AA79C70B}</Project>
     68      <Name>Primes</Name>
     69    </ProjectReference>
    7070  </ItemGroup>
    7171  <ItemGroup>
  • trunk/CrypPlugins/PrimesGenerator/PrimesGenerator.cs

    r582 r809  
    77using Cryptool.PluginBase;
    88using Cryptool.PluginBase.IO;
    9 using LibGmpWrapper;
    109using Cryptool.PluginBase.Tool;
     10using Primes.Bignum;
    1111
    1212namespace Cryptool.PrimesGenerator
     
    1616  public class PrimesGenerator : IRandomNumberGenerator
    1717  {
    18     private GmpBigInteger m_max = new GmpBigInteger("10000000000");
     18      private PrimesBigInteger m_max = new PrimesBigInteger("10000000000");
    1919    public PrimesGenerator()
    2020    {
     
    2222      m_Settings.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(m_Settings_PropertyChanged);
    2323      m_Mode = 0;
    24       m_Input = GmpBigInteger.ValueOf(100);
     24      m_Input = PrimesBigInteger.ValueOf(100);
    2525    }
    2626
     
    6969    }
    7070
    71     private GmpBigInteger m_Input;
     71    private PrimesBigInteger m_Input;
    7272    private int m_Mode;
    7373    private bool hasErrors;
     
    7777      try
    7878      {
    79         m_Input = new GmpBigInteger(m_Settings.Input);
     79        m_Input = new PrimesBigInteger(m_Settings.Input);
    8080        switch (e.PropertyName)
    8181        {
     
    8686            {
    8787              case 0:
    88                 if (m_Input.CompareTo(GmpBigInteger.One) < 0 || m_Input.CompareTo(GmpBigInteger.ValueOf(400)) > 0)
     88                if (m_Input.CompareTo(PrimesBigInteger.One) < 0 || m_Input.CompareTo(PrimesBigInteger.ValueOf(400)) > 0)
    8989                {
    9090                  FireOnGuiLogNotificationOccuredEventError("Value for n has to be greater or equal than one an less or equal than 400.");
     
    9393                break;
    9494              case 1:
    95                 if (m_Input.CompareTo(GmpBigInteger.Ten) < 0 || m_Input.CompareTo(m_max) > 0)
     95                if (m_Input.CompareTo(PrimesBigInteger.Ten) < 0 || m_Input.CompareTo(m_max) > 0)
    9696                {
    9797                  FireOnGuiLogNotificationOccuredEventError("Please enter an Integer value for n.");
     
    135135        {
    136136          case 0:
    137             OutputString = LibGmpWrapper.GmpBigInteger.Random(m_Input).NextProbablePrime().ToString();
     137            OutputString = PrimesBigInteger.Random(m_Input).NextProbablePrime().ToString();
    138138            break;
    139139          case 1:
    140             GmpBigInteger result = LibGmpWrapper.GmpBigInteger.RandomM(m_Input).NextProbablePrime();
     140            PrimesBigInteger result = PrimesBigInteger.RandomM(m_Input).NextProbablePrime();
    141141            while (result.CompareTo(m_Input) > 0)
    142142            {
    143               result = LibGmpWrapper.GmpBigInteger.RandomM(m_Input).NextProbablePrime();
     143              result = PrimesBigInteger.RandomM(m_Input).NextProbablePrime();
    144144            }
    145145            OutputString = result.ToString();
  • trunk/CrypPlugins/PrimesGenerator/PrimesGenerator.csproj

    r4 r809  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    6     <ProductVersion>9.0.21022</ProductVersion>
     6    <ProductVersion>9.0.30729</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    88    <ProjectGuid>{C9BDBD03-DA86-408F-81A0-548D279A1BD8}</ProjectGuid>
     
    3535  </PropertyGroup>
    3636  <ItemGroup>
    37     <Reference Include="LibGmpWrapper, Version=1.0.2987.28787, Culture=neutral, processorArchitecture=x86">
    38       <SpecificVersion>False</SpecificVersion>
    39       <HintPath>..\Primes\Primes.References\LibGmpWrapper.dll</HintPath>
    40     </Reference>
    4137    <Reference Include="PresentationCore">
    4238      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     
    7167      <Name>CrypPluginBase</Name>
    7268    </ProjectReference>
     69    <ProjectReference Include="..\Primes\Primes\Primes.csproj">
     70      <Project>{2830F337-A7A3-4A68-87AC-64F3AA79C70B}</Project>
     71      <Name>Primes</Name>
     72    </ProjectReference>
    7373  </ItemGroup>
    7474  <ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.