示例#1
0
        /// <summary>
        /// Calculate one step in the quarterround function.
        /// </summary>
        protected virtual (uint, uint, uint) QuarterroundStep(uint x1, uint x2, uint x3, int shift)
        {
            x1 += x2;
            uint add = x1;

            x3 ^= x1;
            uint xor = x3;

            x3 = ByteUtil.RotateLeft(x3, shift);
            uint shift_ = x3;

            QRStep.Add(new QRStep(add, xor, shift_));
            return(x1, x2, x3);
        }
示例#2
0
        private void ClearIntermediateResults()
        {
            // matrices
            OriginalState.Clear();
            OriginalStateDiffusion.Clear();
            AdditionResultState.Clear();
            AdditionResultStateDiffusion.Clear();
            LittleEndianState.Clear();
            LittleEndianStateDiffusion.Clear();
            // qr
            QRInput.Clear();
            QRInputDiffusion.Clear();
            QRStep.Clear();
            QRStepDiffusion.Clear();
            QROutput.Clear();
            QROutputDiffusion.Clear();

            InputMessage.Clear();
            Keystream.Clear();
            KeystreamDiffusion.Clear();
            Output.Clear();
            OutputDiffusion.Clear();
        }