Org.BouncyCastle.Crypto.Digests.Sha3Digest.FromBytesToWords C# (CSharp) 메소드

FromBytesToWords() 개인적인 정적인 메소드

private static FromBytesToWords ( ulong stateAsWords, byte state ) : void
stateAsWords ulong
state byte
리턴 void
        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));
                }
            }
        }

Usage Example

예제 #1
0
 private void KeccakPermutation(byte[] state)
 {
     ulong[] stateAsWords = new ulong[state.Length / 8];
     Sha3Digest.FromBytesToWords(stateAsWords, state);
     this.KeccakPermutationOnWords(stateAsWords);
     Sha3Digest.FromWordsToBytes(state, stateAsWords);
 }