I would like to convert the following php code to python
Using the following input:
$securesecret = "5454545454545454646464646"
$hasinput = "user_transactionid=ZXeCLFdcoiyLyONd5Ub99cUOMsFPw9kkDRdfMJY0&vpc_AccessCode=74747474&vpc_Amount=200&vpc_CardExp=2012&vpc_CardNum=4242424242424242&vpc_CardSecurityCode=323&vpc_Command=pay&vpc_Currency=USD&vpc_Gateway=ssl&vpc_MerchTxnRef=22222&vpc_Merchant=52525252&vpc_OrderInfo=22222&vpc_ReturnURL=http://localhost/PHP/PHP_VPC_3DS 2.5 Party_DR.php&vpc_Version=1&vpc_card=Visa"
And this is the output using php and this is correct
D4A3343CB9E41BD328C67299BBCB602CDCE03E9D857C09F3BD94F2DC9112F2FE
However, using python method below with the same input above produces different output.
HMAC.new( force_bytes(securesecret), msg= hashInput.rstrip('&').encode('utf-8'), digestmod=SHA256).hexdigest().upper()
Output from python
7A935F1BE9CA69CD45C985BC2696A6DCFED9CFFD8DED86C5C8593CA974B80974
为什么这两种方法产生不同的输出?