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 4246082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:55:34+00:00 2026-05-21T03:55:34+00:00

I am having a hell of a time trying to md5 hash this with

  • 0

I am having a hell of a time trying to md5 hash this with PHP… The VB code I am trying to port to PHP uses ComputeHash which takes in a byte[] and performs a hash on the whole array.

    Public Shared Function HashBytesMD5(ByVal strInput As String) As Guid
        Dim oHasher As Cryptography.MD5 = Cryptography.MD5.Create()
        Dim oEncoder As New System.Text.UTF8Encoding()
        Dim csData() As Byte

    csData = oEncoder.GetBytes(strInput)
    csData = oHasher.ComputeHash(oEncoder.GetBytes(strInput))
        Return New Guid(csData)
    End Function

Right now I have the following which creates an array of ascii values. Now I need to md5 it like VB.Net does. It doesn’t seem to be as straightforward as it may seem.

  $passHash = $this->ConvertToASCII('123456');
  $passHash = md5(serialize($passHash));


     /*
     * Converts a string to ascii (byte) array
     */
    function ConvertToASCII($password)
    {
        $byteArray = array();

        for ($i=0; $i < strlen($password); $i++)  {
            array_push($byteArray,ord(substr($password,$i)));
        }

        return $byteArray;
    }

Note: the values in the first are the acii values for the characters 123456

Byte array before computeHash md5

  **index**     **Value**                  
      [0]          49                           
      [1]          50            
      [2]          51               
      [3]          52                  
      [4]          53                 
      [5]          54

Byte array returned from VB computeHash function
index value

[0]           225                                     
[1]           10                    
[2]           220                
[3]           57                           
[4]           73                          
[5]           186                     
[6]           89      
[7]           171
[8]           190
[9]           86
[10]          224
[11]          87
[12]          242
[13]          15
[14]          136
[15]          62
  • 1 1 Answer
  • 3 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-21T03:55:35+00:00Added an answer on May 21, 2026 at 3:55 am

    My VB.NET is very rusty but it seems like MD5.ComputeHash()‘s output could be recreated by running your input through md5() and then taking each pair of hex characters (byte) and converting into decimal.

    $passHash = md5('123456');
    $strlen = strlen($passHash) ;
    
    $hashedBytes = array() ;
    $i = 0 ;
    while ($i < $strlen) {
        $pair = substr($passHash, $i, 2) ;
        $hashedBytes[] = hexdec($pair) ;
        $i = $i + 2 ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having one hell of a time trying to get this to work,
I'm having a hell of a time with this simple line of code and
I'm having a hell of a time getting this to cooperate. Basically I'm trying
I'm having one hell of a time trying to get my databinding to work
I'm having a hell of a time finding documentation which clearly explains how to
I'm having a hell of a time trying to get (what I thought was)
Well I'm having a hell of a time trying to get my CPU down
Hello guys i'm having one hell of a time trying to parse an xml
I am currently having a hell of time trying to store sessions in MongoDb.
I'm having a hell of a time trying to debug some kind of memory

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.