using __mm_aeskeygenassist with MS VC++ 2017

  • Thread starter Thread starter Golden Bear55
  • Start date Start date
G

Golden Bear55

Guest
Shown below is a short program that compiles and executes bout does not provide the correct answer.

Any suggestion or comment to fix it is appreciated.

Surry

//aes_key.cpp

#include<wmmintrin.h>

#include<iostream>

#include<stdio.h>


int main() {

int x;

__m128i K0,K11;


// sample key = 54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75


K0.m128i_u64[1] = 0x204B756E67204675;

K0.m128i_u64[0] = 0x5468617473206D79;


K11.m128i_u64[1] = 0xB159E4E6D679A293;

K11.m128i_u64[0] = 0xE232FCF191129188;



__m128i K1 = _mm_aeskeygenassist_si128(K0, 0);


printf_s(" Key: 0x%016I64x%016I64x\n", // original key

K0.m128i_u64[0], K0.m128i_u64[1]);


printf_s(" K0: 0x%016I64x%016I64x\n", //K0 = Original key

K0.m128i_u64[0], K0.m128i_u64[1]);


printf_s(" K1: 0x%016I64x%016I64x\n", //Computed K!

K1.m128i_u64[0], K1.m128i_u64[1]);


printf_s("Expected K1: 0x%016I64x%016I64x\n", //Expected K1

K11.m128i_u64[0], K11.m128i_u64[1]);


std::cin >> x; //view screen output


return 0;


}//end aes_>key()


// Screen Output

// Key: 0x5468617473206d79204b756e67204675

// K0 : 0x5468617473206d79204b756e67204675

// K1 : 0x922045ef2045ef929fb7b39db7b39d9f

// Expected K1 : 0xe232fcf191129188b159e4e6d679a293

Continue reading...
 
Back
Top