Ejemplo n.º 1
0
        public void GenerateNewSbox()
        {
            _randBytesIndex++;
            for (int i = Sboxes.Count - 1; i > 0; i--)
            {
                Sboxes[i] = Sboxes[i - 1];
            }

            byte[] sbox;
            GenerateSubstitution.Generate256(out sbox, ref _randBytesIndex, SigmaValues[SelectedSigmaValueIndex], RValues[SelectedRValueIndex]);
            Sboxes[0] = new Sbox
            {
                ArrayBytes = sbox,
                RValue     = Math.Abs(Stat.CorrelationCoefficient(sbox)),
                SigmaValue = Stat.Sigma256(sbox)
            };
        }
        public void GenerateNewSbox()
        {
            _randBytesIndex++;
            for (int i = Sboxes.Count - 1; i > 0; i--)
                Sboxes[i] = Sboxes[i - 1];

            byte[] sbox;
            GenerateSubstitution.Generate256(out sbox, ref _randBytesIndex, SigmaValues[SelectedSigmaValueIndex], RValues[SelectedRValueIndex]);
            Sboxes[0] = new Sbox
            {
                ArrayBytes = sbox,
                RValue = Math.Abs(Stat.CorrelationCoefficient(sbox)),
                SigmaValue = Stat.Sigma256(sbox)
            };
        }