Phrases sent to unmanagedbridge in batches of 8

unmanaged
Inga 🏳‍🌈 8 years ago
parent c79a41732d
commit 4702fba26b
  1. 9
      dotnet/WhiteRabbit.UnmanagedBridge/WhiteRabbit.UnmanagedBridge.cpp
  2. 2
      dotnet/WhiteRabbit/Constants.cs
  3. 2
      dotnet/WhiteRabbit/PhraseSet.cs
  4. 2
      dotnet/WhiteRabbit/StringsProcessor.cs
  5. 2
      dotnet/WhiteRabbit/WhiteRabbit.csproj

@ -7,5 +7,12 @@
void WhiteRabbitUnmanagedBridge::MD5Unmanaged::ComputeMD5(unsigned int * input, unsigned int* output) void WhiteRabbitUnmanagedBridge::MD5Unmanaged::ComputeMD5(unsigned int * input, unsigned int* output)
{ {
md5(input, output); md5(input + 0 * 8, output + 0 * 4);
md5(input + 1 * 8, output + 1 * 4);
md5(input + 2 * 8, output + 2 * 4);
md5(input + 3 * 8, output + 3 * 4);
md5(input + 4 * 8, output + 4 * 4);
md5(input + 5 * 8, output + 5 * 4);
md5(input + 6 * 8, output + 6 * 4);
md5(input + 7 * 8, output + 7 * 4);
} }

@ -2,6 +2,6 @@
{ {
internal class Constants internal class Constants
{ {
public const int PhrasesPerSet = 1; public const int PhrasesPerSet = 8;
} }
} }

@ -15,7 +15,7 @@
{ {
var permutation = permutations[offset + i]; var permutation = permutations[offset + i];
var startPointer = bufferPointer + i * 8; var startPointer = bufferPointer + i * 8;
byte[] currentWord = words[permutations[offset][0]]; byte[] currentWord = words[permutation[0]];
var j = 0; var j = 0;
var wordIndex = 0; var wordIndex = 0;
var currentPointer = (byte*)startPointer; var currentPointer = (byte*)startPointer;

@ -89,7 +89,7 @@
{ {
var permutations = PrecomputedPermutationsGenerator.HamiltonianPermutations(words.Length); var permutations = PrecomputedPermutationsGenerator.HamiltonianPermutations(words.Length);
var permutationsLength = permutations.Length; var permutationsLength = permutations.Length;
for (var i = 0; i < permutationsLength; i++) for (var i = 0; i < permutationsLength; i += Constants.PhrasesPerSet)
{ {
yield return new PhraseSet(words, permutations, i, this.NumberOfCharacters); yield return new PhraseSet(words, permutations, i, this.NumberOfCharacters);
} }

@ -15,7 +15,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>

Loading…
Cancel
Save