Beispiel #1
0
 internal static void EncryptEcb(
     ReadOnlySpan <byte> plaintext,
     Span <byte> ciphertext,
     Aes128Key key,
     PaddingMode paddingMode = PaddingMode.Zeros)
 {
     ref var expandedKey = ref MemoryMarshal.GetReference(key.ExpandedKey);
Beispiel #2
0
        internal static void EncryptGcm(
            ReadOnlySpan <byte> input,
            Span <byte> output,
            ReadOnlySpan <byte> addt,
            ReadOnlySpan <byte> iv,
            Span <byte> tag,
            Aes128Key key)
        {
            Vector128 <byte> tmp1, tmp2, tmp3, tmp4;
            Vector128 <byte> h, h2, h3, h4, t;
            Vector128 <byte> ctr1, ctr2, ctr3, ctr4;
            var one        = One;
            var four       = Four;
            var bswapEpi64 = BswapEpi64;
            var bswapMask  = BswapMask;
            var x          = Vector128 <byte> .Zero;
            Vector128 <byte> y;
            Span <byte>      lastBlock = stackalloc byte[BlockSize];

            ref var expandedKey  = ref MemoryMarshal.GetReference(key.ExpandedKey);