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

  • SEARCH
  • Home
  • 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 7578847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:31:39+00:00 2026-05-30T17:31:39+00:00

I need to authenticate against an ASP.NET membership table in php. The membership api

  • 0

I need to authenticate against an ASP.NET membership table in php. The membership api is configured to use a hashed password.

Can someone kindly give me the php to hash the password that came from a login form and compare it to the sql field?

I know the password that I’m passing in is correct, but it’s not hashing the same.

private function Auth( $username, $password )
{
    // Hashed password in db
    $hash = $this->parent->_memberData['conv_password'];

    // password passed from form
    $bytes = mb_convert_encoding($password, 'UTF-7');       

    // Salt from db
    $salt = base64_decode($this->parent->_memberData['misc']);

    // hash password from form with salt
    $hashedpassword = base64_encode(sha1($salt . $bytes, true));

    // Test em out
    if ($hashedpassword == $hash)
    {
        $this->return_code = "SUCCESS";
        return true;
    }
    else
    {
        $this->return_code = "WRONG_AUTH";
        return false;
    }
}

UPDATE:

I’ve tried different encodings with same results. UTF-7, UTF-8, and UTF-16.

UPDATE:
I’ve been battling this for a week now. Bounty coming right up…

Here’s the .net code in the form of a unit test. The unit test works and the values are straight out of the database. What’s the correct translation of this code to php?

public void EncodePassword()
        {
        string expected = "aP/mqBu3VkX+rIna42ramuosS3s=";
        string salt = "urIaGX0zd/oBRMDZjc1CKw==";
        string pass = "Comeonman";

        byte[] bytes = Encoding.Unicode.GetBytes(pass);
        byte[] numArray = Convert.FromBase64String(salt);
        byte[] numArray1 = new byte[(int)numArray.Length + (int)bytes.Length];
        byte[] numArray2 = null;
        Buffer.BlockCopy(numArray, 0, numArray1, 0, (int)numArray.Length);
        Buffer.BlockCopy(bytes, 0, numArray1, (int)numArray.Length, (int)bytes.Length);

            HashAlgorithm hashAlgorithm = HashAlgorithm.Create("SHA1");
            if (hashAlgorithm != null)
            {
                numArray2 = hashAlgorithm.ComputeHash(numArray1);
            }

        Assert.AreEqual(Convert.ToBase64String(numArray2), expected);
    }
  • 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-30T17:31:40+00:00Added an answer on May 30, 2026 at 5:31 pm
    $password = 'Comeonman';
    $salt = base64_decode('urIaGX0zd/oBRMDZjc1CKw=='); 
    $utf16Password = mb_convert_encoding($password, 'UTF-16LE', 'UTF-8');
    echo base64_encode(sha1($salt.$utf16Password, true));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my current project, we need to authenticate users of an ASP.NET application against
Is it possible to use the built in ASP.NET membership provider to secure a
I'm attempting to authenticate using users and groups in ASP.NET MVC against Active Directory.
I have a project requirement where I need to authenticate against ActiveDirectory in a
I want to authenticate users against our AD so I understand that I need
My company has several web applications written in ASP.NET. We need to make these
when I need to authenticate client applications against X.509 protected SSL, TLS and SSH
Hi All Nightowls out there :), I need to authenticate username and password provided
What is the best practice when you need to authenticate specific OperationContracts , while
I'm failing at finding the commands I need to send to authenticate to a

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.