示例#1
0
 protected virtual unsafe void SalsaRound(uint[] x)
 {
     fixed(uint *p = x)
     {
         Salsa20Utils.SalsaRound(p, Rounds);
     }
 }
示例#2
0
 protected override unsafe void UpdateKeyStream()
 {
     fixed(uint *x = State)
     fixed(byte *s = KeyStream)
     {
         Salsa20Utils.UpdateKeyStream(x, s, Rounds);
     }
 }
示例#3
0
        protected override unsafe void UpdateKeyStream()
        {
            if (IsSupport)
            {
                if (Sse2.IsSupported)
                {
                    fixed(uint *x = State)
                    fixed(byte *s = KeyStream)
                    {
                        Salsa20Utils.UpdateKeyStream(x, s, Rounds);
                    }
                    return;
                }
            }

            Salsa20Utils.UpdateKeyStream(Rounds, State, KeyStream);
        }
示例#4
0
    protected override unsafe void UpdateBlocks(ref uint *state, ref byte *source, ref byte *destination, ref int length)
    {
        if (Avx.IsSupported && Avx2.IsSupported)
        {
            if (length >= 512)
            {
                Salsa20Utils.SalsaCore512(Rounds, state, ref source, ref destination, ref length);
            }

            while (length >= 128)
            {
                Salsa20Utils.SalsaCore128(Rounds, state, source, destination);

                source      += 128;
                destination += 128;
                length      -= 128;
            }
        }

        if (Sse2.IsSupported)
        {
            if (length >= 256)
            {
                Salsa20Utils.SalsaCore256(Rounds, state, ref source, ref destination, ref length);
            }

            while (length >= 64)
            {
                Salsa20Utils.SalsaCore64(Rounds, state, source, destination);

                source      += 64;
                destination += 64;
                length      -= 64;
            }
        }
    }
示例#5
0
 protected override void SalsaRound(uint[] x)
 {
     Salsa20Utils.SalsaRound(Rounds, x);
 }
示例#6
0
 protected override void UpdateKeyStream()
 {
     Salsa20Utils.UpdateKeyStream(Rounds, State, KeyStream);
 }
示例#7
0
 protected override unsafe void SnuffleCore512(uint *state, ref byte *source, ref byte *destination, ref int length)
 {
     Salsa20Utils.SalsaCore512(Rounds, state, ref source, ref destination, ref length);
 }
示例#8
0
 protected override unsafe void SnuffleCore128(uint *state, byte *source, byte *destination)
 {
     Salsa20Utils.SalsaCore128(Rounds, state, source, destination);
 }