private static void FromWordsToBytes(byte[] state, ulong[] stateAsWords) { for (int i = 0; i < (1600 / 64); i++) { int index = i * (64 / 8); for (int j = 0; j < (64 / 8); j++) { state[index + j] = (byte)(stateAsWords[i] >> (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); }