Find Jobs
Hire Freelancers

Complete my HMAC decryption in PHP -- 2

$10-30 USD

进行中
已发布将近 9 年前

$10-30 USD

货到付款
We are looking for a PHP version of the google HMAC encrypt method described in this link [login to view URL] Our supplier deliverd some keys to test the algorytm. e_key = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa i_key = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb data = qMgSYozqy_iTLthA_kqjsm_Y7PlGcHiO4UU9aw== I wrote a piece of code, but i can't find the answer why it is not working. Probably the php base64 encoding algorithm in PHP is not supporting RFC 3548. When the method is implemented correctly the result has to be a number with decimals. When i execute my method with the above data the output is gibberish. We’re looking for a work-around. Hereby our code //[login to view URL] function hmacEncrypt($price, $iv, $e_key, $i_key) { $pad = substr(hash_hmac('sha1', $iv, $e_key), 0, 8); $enc_price = $pad ^ $price; $signature = substr(hash_hmac('sha1', $price . $iv, $i_key), 0, 4); $final_message = base64_encode($iv . $enc_price . $signature); return $final_message; } function hmacDecrypt($final_message, $e_key, $i_key) { //$enc_price = base64_decode($final_message); $enc_price = base64_decode($final_message, 16); $iv = substr($enc_price, 0, 16); $signature = substr($enc_price, strlen($enc_price) - 4, 4); $p = substr($enc_price, 16, 8); $price_pad = substr(hash_hmac('sha1', $iv, $e_key), 0, 8); $price = $p ^ $price_pad; $conf_sig = substr(hash_hmac('sha1', $price . $iv, $i_key), 0, 4); return $price; if ($conf_sig === $signature) { return floatval($price); } } echo hmacDecrypt('qMgSYozqy_iTLthA_kqjsm_Y7PlGcHiO4UU9aw==', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
项目 ID: 7784881

关于此项目

2提案
远程项目
活跃9 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
Dear Sir, Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned I have checked your requirements.i have right skills to work on this assignment my award = superb result = happy client. In a good partnership, good results happen. Good cooking makes good eating!BWe consider our client as our partner. can u provide your email or sky-pe etc for further discussion about the project. I am ready to discuss with you with best Regards
$25 USD 在1天之内
0.0 (0条评论)
0.0
0.0
2威客以平均价$25 USD来参与此工作竞价
用户头像
A proposal has not yet been provided
$25 USD 在2天之内
5.0 (24条评论)
4.8
4.8

关于客户

NETHERLANDS的国旗
Almere, Netherlands
0.0
0
付款方式已验证
会员自6月 2, 2015起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。