Java用mac和c++用openssL生成的HMacSHA256的结果不一样?

问题遇到的现象和发生背景

Java用mac和c++用openssL生成的HMacSHA256的结果不一样?

问题相关代码,请勿粘贴截图

java:
byte[] hMacOut;
try {
Mac hMac = Mac.getInstance("HmacSHA256");
System.out.println(KEY.toCharArray());
byte[] key ="ijron(&)(')MORJDdxjom(%)(&)MOJRD".getBytes(StandardCharsets.UTF_8);
SecretKeySpec secretKey = new SecretKeySpec(key,"HmacSHA256");
hMac.init(secretKey);
hMacOut = hMac.doFinal("123456123456781662542287".getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
logger.error("genCode failed: ", e);
return null;
}
c++:
HMAC_CTX* ctx = HMAC_CTX_new();
if (ctx != NULL)
{
HMAC_Init_ex(ctx, secKey, lenKey, EVP_sha256(), NULL);
HMAC_Update(ctx, (const unsigned char*)strData.c_str(), strData.length());
HMAC_Final(ctx, hMacOut, &hMacLen);
HMAC_CTX_free(ctx);
}

我想要达到的结果

两种方法的返回对象不同,但是数组的大小是相同,为什么会不一样