Example #1
0
        private static UInt512 Initialize(UInt512 bState, uint xState0, uint xState1, uint xState2, uint xState3)
        {
            var t0 = bState.I0;
            var t1 = bState.I1;
            var t2 = bState.I2;
            var t3 = bState.I3;
            var t4 = bState.I4;
            var t5 = bState.I5;
            var t6 = bState.I6;
            var t7 = bState.I7;
            var t8 = bState.I8;
            var t9 = bState.I9;
            var tA = bState.IA;
            var tB = bState.IB;
            var tC = bState.IC;
            var tD = bState.ID;
            var tE = bState.IE;
            var tF = bState.IF;

            for (var i = 0UL; i < 10UL; i++)
            {
                ChaCha.DoubleRound(
                    ref t0,
                    ref t1,
                    ref t2,
                    ref t3,
                    ref t4,
                    ref t5,
                    ref t6,
                    ref t7,
                    ref t8,
                    ref t9,
                    ref tA,
                    ref tB,
                    ref tC,
                    ref tD,
                    ref tE,
                    ref tF
                    );
            }

            return(new UInt512(
                       ChaCha.SIGMA0,
                       ChaCha.SIGMA1,
                       ChaCha.SIGMA2,
                       ChaCha.SIGMA3,
                       t0,
                       t1,
                       t2,
                       t3,
                       tC,
                       tD,
                       tE,
                       tF,
                       xState0,
                       xState1,
                       xState2,
                       xState3
                       ));
        }
Example #2
0
 public void Transform(string fileName) => ChaCha.Transform(m_state, 20UL, fileName);
Example #3
0
 public void Transform(byte[] data) => ChaCha.Transform(m_state, 20UL, data);
Example #4
0
 public void Transform(Stream stream) => ChaCha.Transform(m_state, 20UL, stream);
Example #5
0
 public void Transform(Stream source, Stream destination) => ChaCha.Transform(m_state, 20UL, source, destination);