Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create hmac md5 in php?

Tags:

php

I am working with payU credit card systems. But I dont manage. payU tells me that I have to create hmac md5 hashes.

My secret key is : 3~9#[X4^660?ak+]h6%T I want to convert to a HMAC_MD5 hash : 8GEMISEPE6208617192012-12-15 15:58:476Deneme117Deneme202103NET112242103TRY2107Antalya7Antalya2TR8CCVISAMC2,3,7,10,12

What's the php code?

like image 375
Ibrahim Basegmez Avatar asked Nov 29 '22 01:11

Ibrahim Basegmez


1 Answers

You can easily do that using the hash_hmac() function:

$input = 'foo';
$output = hash_hmac('md5', $input, $secretKey);

where $secretKey holds a string representation of your key.

like image 70
Niko Avatar answered Dec 06 '22 07:12

Niko