In Bearbeitung

Complete my HMAC decryption in PHP -- 2

We are looking for a PHP version of the google HMAC encrypt method described in this link

[url removed, login to view]

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

//[url removed, login to view]

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');

Fähigkeiten: PHP, Softwarearchitektur

Mehr sehen: my supplier find, codelock php decryption script, php ajax search box supporting arrow keys, php wait file complete, online php decryption, flex php decryption, ajax php mysql auto complete sample, algorithm search large text file php, complete code design upload image modify image php, complete loan algorithm creator, google maps php mysql api complete

Über den Arbeitgeber:
( 0 Bewertungen ) Almere, Netherlands

Projekt-ID: #7784881

Vergeben an:

dynamicsoft4

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 requir Mehr

$25 USD in 1 Tag
(0 Bewertungen)
0.0

3 Freelancer bietetn im Durchschnitt $25 für diesen Job an

pandalion98

A proposal has not yet been provided

$25 USD in 2 Tagen
(4 Bewertungen)
2.4
pjeet1078

A proposal has not yet been provided

$25 USD in 1 Tag
(0 Bewertungen)
0.0