示例#1
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;
            }
        }
    }
示例#2
0
 protected override unsafe void SnuffleCore128(uint *state, byte *source, byte *destination)
 {
     Salsa20Utils.SalsaCore128(Rounds, state, source, destination);
 }