Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php与c++;hmac不一致_Php_C++_Hmac - Fatal编程技术网

php与c++;hmac不一致

php与c++;hmac不一致,php,c++,hmac,Php,C++,Hmac,我正在尝试集成一个游戏引擎(c++)和一个服务器(php) c++ php 问题是我的哈希值不匹配,我不确定我做错了什么 char key[] = "012345678"; // The data that we're going to hash using HMAC char hashStr[] = "hello world"; unsigned char* result = HMAC(EVP_sha256(), key, strlen(key) , (unsigned char*)has

我正在尝试集成一个游戏引擎(c++)和一个服务器(php)

c++

php

问题是我的哈希值不匹配,我不确定我做错了什么

char key[] = "012345678";

// The data that we're going to hash using HMAC
char hashStr[] = "hello world";

unsigned char* result = HMAC(EVP_sha256(), key, strlen(key) , (unsigned char*)hashStr, strlen(hashStr), NULL, NULL);  
$key = "012345678";
$msg = "hello world";


$hash = hash_hmac ( 'sha256' , $msg ,  $key , true );

echo(bin2hex($hash));