gpt4 book ai didi

php - ColdFusion 相当于 PHP hash_hmac

转载 作者:搜寻专家 更新时间:2023-10-31 21:15:13 24 4
gpt4 key购买 nike

$key = "12345678876543211234567887654321";
$iv = "1234567887654321";
$plaindata = "This is a test string";

$enc = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaindata, MCRYPT_MODE_CBC, $iv));

$str = hash_hmac("sha256", utf8_encode($iv . '.' . $enc), utf8_encode($key));

echo($str);

这给了我 e63d4ab83f90cfec1acdaf831091b6394167ae728b657e44afad1e7553843eeb

如何在 ColdFusion9 开发版中获得相同的结果?

最佳答案

我在此页面上找到了解决方案 http://www.isummation.com/blog/calculate-hmac-sha256-digest-using-user-defined-function-in-coldfusion/

你需要这样调用函数

<cfoutput>#LCase(HMAC_SHA256(iv & "." & Encrypted_Data, key))#</cfoutput>

像魅力一样工作。

关于php - ColdFusion 相当于 PHP hash_hmac,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10331980/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com