private static void FromBytesToWords(ulong[] stateAsWords, byte[] state) { for (int i = 0; i < (1600 / 64); i++) { stateAsWords[i] = 0; int index = i * (64 / 8); for (int j = 0; j < (64 / 8); j++) { stateAsWords[i] |= ((ulong)state[index + j] & 0xff) << ((8 * j)); } } }
private void KeccakPermutation(byte[] state) { ulong[] stateAsWords = new ulong[state.Length / 8]; Sha3Digest.FromBytesToWords(stateAsWords, state); this.KeccakPermutationOnWords(stateAsWords); Sha3Digest.FromWordsToBytes(state, stateAsWords); }