Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6636637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:12:40+00:00 2026-05-25T23:12:40+00:00

Please I need help getting the exact md5 value of this python script in

  • 0

Please I need help getting the exact md5 value of this python script in PHP

The Python script

def md5code(params):
    params = {'identifier': ' ', 'amount': '0.0', 'code': 'UNIA'}
    req = dict([[key, params.get(key, '')] for key in ['code', 'identifier', 'amount']]) 
    secret = '2fd0bba6b1774ed391c1ff8467f52a5d'
    text = ":".join([req[x] for x in ['code', 'identifier', 'amount']] + secret)
    return md5(text).hexdigest().upper()

The return value is: 5D316CD2311678A1B12F6152988F3097

The PHP script

$secret = '2fd0bba6b1774ed391c1ff8467f52a5d';
$code = 'UNIA';
$valid_institution = array('amount' => '0.0', 'code' => $code, 'identifier' => ' ');
foreach($valid_institution as $k => $v) {
    $text = implode(":", $v[$k] + $secret);
}
print strtoupper(hash("md5", $text)); 

The return value is: D41D8CD98F00B204E9800998ECF8427E

I’m expecting the PHP script to return an exact md5 value, but it is not.

Any suggestions will be appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:12:41+00:00Added an answer on May 25, 2026 at 11:12 pm

    ok, seems you’re using foreach in a wrong way. Try this:

    $secret = '2fd0bba6b1774ed391c1ff8467f52a5d';
    $code = 'UNIA';
    $valid_institution = array('amount' => '0.0', 'code' => $code, 'identifier' => ' ');
    $text = 
        $valid_institution['code'] . ":" . 
        $valid_institution['identifier'] . ":" . 
        $valid_institution['amount'] . ":" . 
        $secret;
    
    print strtoupper(hash("md5", $text)); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting a little confused and need some help please. Take these two
I need some help with a LINQ query in VB.Net, please. I have this
need help... the getting input form: <select name=age> <option value=25-30>25-30</option> <option value=31-40>31-40</option> <option value=41-50>41-50</option>
Great Mates... I need your help.. please let me know why this code is
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
I need some help! Please. I am trying to develop a very very simple
I need some with help with PowerShell, please. It should be pretty easy: I
Please help! I need to produce a Crystal Report with multiple data columns, but
Please help to the newbie in WPF! I need to build a TreeView with
I need to convert the function path::combine(path1, path2). Please help me if you have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.