Implementation of SHA-3 based on following KeccakNISTInterface.c from http://keccak.noekeon.org/
Following the naming conventions used in the C source code to enable easy review of the implementation.
Inheritance: IDigest
Esempio n. 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);
 }
Esempio n. 2
0
 private void KeccakPermutationOnWords(ulong[] state)
 {
     for (int i = 0; i < 24; i++)
     {
         this.Theta(state);
         this.Rho(state);
         this.Pi(state);
         this.Chi(state);
         Sha3Digest.Iota(state, i);
     }
 }
Esempio n. 3
0
 private void CopyIn(Sha3Digest source)
 {
     Array.Copy(source.state, 0, this.state, 0, source.state.Length);
     Array.Copy(source.dataQueue, 0, this.dataQueue, 0, source.dataQueue.Length);
     this.rate                      = source.rate;
     this.bitsInQueue               = source.bitsInQueue;
     this.fixedOutputLength         = source.fixedOutputLength;
     this.squeezing                 = source.squeezing;
     this.bitsAvailableForSqueezing = source.bitsAvailableForSqueezing;
     this.chunk                     = Arrays.Clone(source.chunk);
     this.oneByte                   = Arrays.Clone(source.oneByte);
 }
Esempio n. 4
0
 public Sha3Digest(Sha3Digest source) : base(source)
 {
 }
Esempio n. 5
0
		private void CopyIn(Sha3Digest source)
		{
            Array.Copy(source.state, 0, this.state, 0, source.state.Length);
            Array.Copy(source.dataQueue, 0, this.dataQueue, 0, source.dataQueue.Length);
            this.rate = source.rate;
            this.bitsInQueue = source.bitsInQueue;
            this.fixedOutputLength = source.fixedOutputLength;
            this.squeezing = source.squeezing;
            this.bitsAvailableForSqueezing = source.bitsAvailableForSqueezing;
            this.chunk = Arrays.Clone(source.chunk);
            this.oneByte = Arrays.Clone(source.oneByte);
        }
Esempio n. 6
0
        public Sha3Digest(Sha3Digest source)
        {
			CopyIn(source);
		}
Esempio n. 7
0
        public void Reset(IMemoable other)
        {
            Sha3Digest d = (Sha3Digest)other;

            CopyIn(d);
        }
Esempio n. 8
0
 public Sha3Digest(Sha3Digest source)
 {
     CopyIn(source);
 }
Esempio n. 9
0
 public Sha3Digest(Sha3Digest source)
     : base(source)
 {
 }
Esempio n. 10
0
        public void Reset(IMemoable other)
        {
            Sha3Digest source = (Sha3Digest)other;

            this.CopyIn(source);
        }
Esempio n. 11
0
 public Sha3Digest(Sha3Digest source)
 {
     this.CopyIn(source);
 }