public static ulong[] ErrorPropagationText() { ulong[] text = FillText(GetRandomBlock); uint[] key = new uint[KeySegmentsCount]; ulong[,] result = new ulong[N, BlockBitLength]; Parallel.For(0, N, i => { Parallel.For(0, BlockBitLength, j => { result[i, j] = Encode(text[i], key) ^ Encode(text[i] ^ (0 | (uint)1 << (j % BlockBitLength)), key); }); }); return(result.Cast <ulong>().ToArray()); }
public static ulong[] ErrorPropagationKey() { ulong text = 0; BitArray[] keys = new BitArray[N].Select(_ => GetRandomKey()).ToArray(); ulong[,] result = new ulong[N, KeyBitLength]; Parallel.For(0, N, i => { for (int j = 0; j < KeyBitLength; j++) { BitArray delta_key = new BitArray(KeyBitLength); delta_key[j] = true; result[i, j] = Encode(text, keys[i]) ^ Encode(text, ((BitArray)keys[i].Clone()).Xor(delta_key)); } }); return(result.Cast <ulong>().ToArray()); }