Esempio n. 1
0
    public static IStreamCrypto Sm4Ctr(ReadOnlySpan <byte> key, ReadOnlySpan <byte> iv)
    {
        if (Aes.IsSupported && Avx.IsSupported && Avx2.IsSupported)
        {
            return(new CTR128StreamModeBlock16X86(new SM4CryptoBlock16X86(key), iv));
        }

        if (Aes.IsSupported && Sse2.IsSupported && Ssse3.IsSupported && Sse41.IsSupported)
        {
            return(new CTR128StreamModeBlock8X86(new SM4CryptoBlock8X86(key), iv));
        }

        return(BlockCryptoModeCreate.Ctr(new SM4Crypto(key), iv));
    }
Esempio n. 2
0
 public static IStreamCrypto AesCtr(ReadOnlySpan <byte> key, ReadOnlySpan <byte> iv)
 {
     return(BlockCryptoModeCreate.Ctr(AESUtils.CreateECB(key), iv));
 }