Ejemplo n.º 1
0
        public long GetPhrasesCount()
        {
            var sums = this.VectorsProcessor.GenerateSequences();

            return((from sum in sums
                    let filter = ComputeFilter(sum)
                                 let wordsVariantsNumber = this.ConvertVectorsToWordsNumber(sum)
                                                           let permutationsNumber = PrecomputedPermutationsGenerator.GetPermutationsNumber(sum.Length, filter)
                                                                                    let total = wordsVariantsNumber * permutationsNumber
                                                                                                select total)
                   .Sum());
        }
Ejemplo n.º 2
0
        private void ProcessSum(int[] sum, uint[] expectedHashesVector, Action <byte[], uint> action)
        {
            var initialPhraseSet = new PhraseSet();

            initialPhraseSet.Init();
            initialPhraseSet.FillLength(this.NumberOfCharacters, sum.Length);
            var phraseSet = new PhraseSet();

            phraseSet.Init();
            var permutationsFilter = ComputeFilter(sum);
            var wordsVariants      = this.ConvertVectorsToWordIndexes(sum);

            foreach (var wordsArray in Flattener.Flatten(wordsVariants))
            {
                phraseSet.ProcessPermutations(
                    initialPhraseSet,
                    this.AllWords,
                    wordsArray,
                    PrecomputedPermutationsGenerator.HamiltonianPermutations(wordsArray.Length, permutationsFilter),
                    expectedHashesVector,
                    action);
            }
        }
Ejemplo n.º 3
0
 // Ensure that permutations are precomputed prior to main run, so that processing times will be correct
 static StringsProcessor()
 {
     PrecomputedPermutationsGenerator.HamiltonianPermutations(1, 0);
 }