|
|
@ -35,7 +35,6 @@ |
|
|
|
public IEnumerable<Vector<byte>[]> GenerateSums(IEnumerable<Vector<byte>> vectors) |
|
|
|
public IEnumerable<Vector<byte>[]> GenerateSums(IEnumerable<Vector<byte>> vectors) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var filteredVectors = FilterVectors(vectors); |
|
|
|
var filteredVectors = FilterVectors(vectors); |
|
|
|
|
|
|
|
|
|
|
|
var dictionary = ImmutableStack.Create(filteredVectors.ToArray()); |
|
|
|
var dictionary = ImmutableStack.Create(filteredVectors.ToArray()); |
|
|
|
var orderedSums = GenerateOrderedSums(this.Target, ImmutableStack.Create<Vector<byte>>(), dictionary); |
|
|
|
var orderedSums = GenerateOrderedSums(this.Target, ImmutableStack.Create<Vector<byte>>(), dictionary); |
|
|
|
var allSums = orderedSums.SelectMany(GeneratePermutations); |
|
|
|
var allSums = orderedSums.SelectMany(GeneratePermutations); |
|
|
@ -46,9 +45,7 @@ |
|
|
|
private IEnumerable<Vector<byte>> FilterVectors(IEnumerable<Vector<byte>> vectors) |
|
|
|
private IEnumerable<Vector<byte>> FilterVectors(IEnumerable<Vector<byte>> vectors) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return vectors |
|
|
|
return vectors |
|
|
|
.Where(vector => ((this.Target - vector) & Negative) == Vector<byte>.Zero) |
|
|
|
.Where(vector => ((this.Target - vector) & Negative) == Vector<byte>.Zero); |
|
|
|
//.OrderByDescending(vector => this.GetWeight(vector)) //so that letters that are more rare will come first |
|
|
|
|
|
|
|
.ToList(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Conditional("DEBUG")] |
|
|
|
[Conditional("DEBUG")] |
|
|
|