简体   繁体   中英

php script to generate checksum from md5

In order to calculate the checksum i need following things. these parameters are concatenated in a constant (no spaces) string made up of the values of the following parameters in the exact order listed below: o Secret Key o Merchant id o Currency o Total amount o Item list (item_name_1, Item_amount_1, item_quantity_1 to item_name_N, Item_amount_N, item_quantity_N) o Timestamp

eg In that case the string befor hash will be: pLAZdfhdfdNh57583USD69.99Tier2 item69.9912010-06-14.14:34:33

And using the MD5 hash function the result is: ghvsaf764t3w784tbjkegbjhdbgf

i want to know how can i create a php script that will call md5 hash function with the inputs given above and based on that it will generate the hash function value that will be the checksum value for my coding..

try

echo md5('pLAZdfhdfdNh57583USD69.99Tier2 item69.9912010-06-14.14:34:33');

That will do exacly what you asked. Unless you need help writting the whole script.

$md5String = $element1 . $element2 . $element3; // ..etc 
$myMd5 = md5($md5String);

I dont know how each of your items come into play but thats basically the easiest way to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM