本文介绍了在MS VC ++ 2017中使用__mm_aeskeygenassist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面显示的是一个简短的程序,它编译并执行bout无法提供正确的答案。

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

//aes_key.cpp


#include < wmmintrin.h>

#include<wmmintrin.h>


#include < iostream>

#include<iostream>


#include < stdio.h>

#include<stdio.h>



int main(){


int x;


__ m128i K0,K11;

__m128i K0,K11;



// 样本密钥= 54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75

// 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[1] = 0x204B756E67204675;


K0.m128i_u64 [0] = 0x5468617473206D79;

K0.m128i_u64[0] = 0x5468617473206D79;



K11.m128i_u64 [1] = 0xB159E4E6D679A293;

K11.m128i_u64[1] = 0xB159E4E6D679A293;


K11.m128i_u64 [0] = 0xE232FCF191129188;

K11.m128i_u64[0] = 0xE232FCF191129188;




__ m128i K1 = _mm_aeskeygenassist_si128(K0, 0);

__m128i K1 = _mm_aeskeygenassist_si128(K0, 0);



printf_s("   ;  密钥:0x%016I64x%016I64x \ n"
// 原始密钥

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


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

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



printf_s("   ;   K0:0x%016I64x%016I64x \ n"
// K0 =原始密钥

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


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

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



printf_s("   ;   K1:0x%016I64x%016I64x \ n"
//计算K!

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


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

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



printf_s("预计K1: 0x%016I64x%016I64x \ n"
//预期K1

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


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

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



std :: cin
>> x; 
//查看屏幕输出

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



返回 0;



} //结束aes_> key()

}//end aes_>key()



// 屏幕输出


// 密钥:0x5468617473206d79204b756e67204675

//  Key: 0x5468617473206d79204b756e67204675


// K0:0x5468617473206d79204b756e67204675

// K0 : 0x5468617473206d79204b756e67204675


// K1:0x922045ef2045ef929fb7b39db7b39d9f

// K1 : 0x922045ef2045ef929fb7b39db7b39d9f


// 预期K1:0xe232fcf191129188b159e4e6d679a293

// Expected K1 : 0xe232fcf191129188b159e4e6d679a293

推荐答案

  
K0.m128i_u64 [0] = 0x79 ... 6854;

  
K0.m128i_u64 [1] = 0x75 ... 4B20;

  K0.m128i_u64[0] = 0x79…6854;
  K0.m128i_u64[1] = 0x75…4B20;


这篇关于在MS VC ++ 2017中使用__mm_aeskeygenassist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 23:35