예제 #1
0
        private void btnGenerateSequenceToFile_Click(object sender, EventArgs e)
        {
            if (!IsFilterOpen)
            {
                return;
            }

            string filename = FormHelper.SaveFileDlg(FormHelper.FiletypeFilters.SequenceFiles);

            if (!string.IsNullOrWhiteSpace(filename))
            {
                int randomNumber = rand.Next(50000);

                BigInteger randomIncrementValue = PrimeHelper.GetPreviousPrime(randomNumber);

                ByteGenerator.SequenceGenerator randomSequence = new ByteGenerator.SequenceGenerator(8, randomNumber, (int)randomIncrementValue);

                int           counter            = 0;
                int           maxElements        = filter.MaxElementsToHash / 2;
                List <string> elementsCollection = new List <string>();
                while (counter < maxElements)
                {
                    string nextElement = randomSequence.GetNext();
                    elementsCollection.Add(nextElement);
                    counter++;
                }

                File.WriteAllLines(filename, elementsCollection);
            }
        }
예제 #2
0
        private void BuildMultiplicativeGroupParameters()
        {
            BigInteger prime = _filterSize + 1;

            int counter = 0;

            while (counter < _hashesPerElement)
            {
                prime = PrimeHelper.GetPreviousPrime(prime);
                BigInteger generator = CalculatePrimitiveRoot(prime);

                _multiplicativeGroupParameters.Add(new Tuple <BigInteger, BigInteger>(prime, generator));

                counter++;
            }
        }