Exportar (0) Imprimir
Expandir todo
Expandir Minimizar

_mm_aesenc_si128

Visual Studio 2010

Microsoft Specific

Emits the Advanced Encryption Standard (AES) instruction aesenc. This instruction performs one round of AES encryption.

__m128i _mm_aesenc_si128 (
   __m128i v,
   __m128i rkey
); 

Parameter

Description

[in] v

The data that this instruction encrypts.

[in] rkey

The round key that this instruction uses to encrypt the data in v.

The encrypted form of the data in v.

Intrinsic

Architecture

_mm_aesenc_si128

x86, x64

Header file <wmmintrin.h>

This instruction encrypts data by using an Equivalent Inverse Cipher with a 128 bit key. AES encryption requires 10 iterations of encryption by using a cipher key that is 128 bits. Each iteration uses this instruction, except for the last iteration. The last iteration must be performed by _mm_aesenclast_si128.

To decrypt the encoded data, use _mm_aesdec_si128.

#include <wmmintrin.h>
#include <stdio.h>

int main()
{
    __m128i a;
    __m128i res;
    __m128i key;

    a.m128i_u64[1] = 0x8899AABBCCDDEEFF;
    a.m128i_u64[0] = 0x0123456789ABCDEF;
    key.m128i_u64[1] = 0x0022446688AACCEE;
    key.m128i_u64[0] = 0x1133557799BBDDFF;

    res = _mm_aesenc_si128( a, key );

    printf_s("Original data: 0x%016I64x%016I64x\n",
        a.m128i_u64[1], a.m128i_u64[0]);
    printf_s("Encoded data: 0x%016I64x%016I64x\n",
        res.m128i_u64[1], res.m128i_u64[0]);

    return 0;
}
Original data: 0x8899aabbccddeeff0123456789abcdef
Encoded data: 0x28e4ee188450433316ab0e57dfc442ed

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft