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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:49:03+00:00 2026-05-18T02:49:03+00:00

Looking for a method or to be pointed in the right direction so I

  • 0

Looking for a method or to be pointed in the right direction so I can return an hash equal to the hash returned by FormsAuthentication.HashPasswordForStoringInConfigFile("asdf", "MD5"). I’ve been trying code like:

        ASCIIEncoding encoding = new ASCIIEncoding();
        encoding.GetBytes("asdf");

        var hashedBytes = MD5.Create().ComputeHash(bytes);
        var password = encoding.GetString(hashedBytes);

I’m not that strong on Hashing so I don’t know where to go next. I always end up with crazy special characters while the FormsAuth method always returns something readable.

Just trying to remove the external dependency to FormAuthentication from some internal business classes.

  • 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-18T02:49:04+00:00Added an answer on May 18, 2026 at 2:49 am

    Here is the reflector’s output:

    Your problem is not using UTF8

    public static string HashPasswordForStoringInConfigFile(string password, string passwordFormat)
    {
        HashAlgorithm algorithm;
        if (password == null)
        {
            throw new ArgumentNullException("password");
        }
        if (passwordFormat == null)
        {
            throw new ArgumentNullException("passwordFormat");
        }
        if (StringUtil.EqualsIgnoreCase(passwordFormat, "sha1"))
        {
            algorithm = SHA1.Create();
        }
        else
        {
            if (!StringUtil.EqualsIgnoreCase(passwordFormat, "md5"))
            {
                throw new ArgumentException(SR.GetString("InvalidArgumentValue", new object[] { "passwordFormat" }));
            }
            algorithm = MD5.Create();
        }
        return MachineKeySection.ByteArrayToHexString(algorithm.ComputeHash(Encoding.UTF8.GetBytes(password)), 0);
    }
    

    So here is your updated code:

        encoding.GetBytes("asdf");
    
        var hashedBytes = MD5.Create().ComputeHash(bytes);
        var password = Encoding.UTF8.GetString(hashedBytes);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working with a school project, and one of the tasks is to
I'm looking to use the Zimt library and the ZTWebSocket class has a 'send'
I am currently looking into different ways to support distributed model objects (that is,
I was just looking for a handy base class for a set of functors
Sorry if this sounds like a bit of a noobie question, i'm still relatively
I'm going to need to push and pull files from a SharePoint site that
Just curious if anybody knows what Ruby technique is used to accomplish the following
In Java, with Sun's JDK 1.6, with an enum such as this: public enum
Possible Duplicate: Determine if Type is a pointer in a template function I am

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.