Condividi tramite


_mm_aesenclast_si128

Microsoft Specific

Emits the Advanced Encryption Standard (AES) instruction aesenclast. This instruction performs the final round of AES encryption.

__m128i _mm_aesenclast_si128 (
   __m128i v,
   __m128i rkey
);

Parameters

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.

Return value

The encrypted form of the data in v.

Requirements

Intrinsic

Architecture

_mm_aesenclast_si128

x86, x64

Header file <wmmintrin.h>

Remarks

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. You must perform the final iteration with this instruction. The previous nine iterations use _mm_aesenc_si128.

To decrypt the encoded data, use _mm_aesdeclast_si128.

Example

#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_aesenclast_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: 0x4b04f98cf4c860f8b6dd7df25d7ab320

See Also

Reference

Compiler Intrinsics

_mm_aesenc_si128

_mm_aesdeclast_si128

AES Intrinsics