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

The Archive Base Latest Questions

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

I am storing an encrypted password using the Settings file in the project. The

  • 0

I am storing an encrypted password using the Settings file in the project. The encryption used is md5, everything up to saving the hash works just fine. When I look in the app.config I can see the correct hash there too. However when retreiving the hash the string has it’s characters escaped which makes a comparison not possible

This is the code I use to generate the hash

System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] data = System.Text.Encoding.ASCII.GetBytes(password);
data = x.ComputeHash(data);
String md5Hash = System.Text.Encoding.ASCII.GetString(data);

For testing I put in the text “Test” which generates “\f?f?T\v???8??Za[“

When retreiving the password from the settings file I get “\\f?f?T\\v???8??Za[“

How to get around this problem?

  • 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-27T23:26:26+00:00Added an answer on May 27, 2026 at 11:26 pm

    Firstly, don’t do that. The data returned from ComputeHash isn’t ASCII-encoded text, so you shouldn’t be calling Encoding.ASCII.GetString(data). Prefer Convert.ToBase64String(data) – and also prefer hashing using Encoding.UTF8.GetBytes(password), as otherwise you’ll lose data for non-ASCII passwords.

    Secondly, I suspect that the data isn’t really being escaped when you retrieve it – my guess is that you’re looking at it in the Visual Studio debugger, and that’s adding the escaping, rather than it being present in the actual string. Examine the result of md5Hash.ToCharArray() to see it one character at a time.

    Thirdly, use a better hash than MD5 for passwords 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using MD5 encryption for storing the password in the database. We
I would be using MD5 hashing to store encrypted passwords. Password can be 6
I'm encrypting and Base64 a string. Everything works great, until I retrieve the encrypted
I'm using md5 encryption for my company salary data. That page should only be
I have a file dsn containing encrypted password. I need to get the decrypted
How can I decrypt a password string in PHP which was encrypted with crypt
Does mysql provide a mechanism for storing and retrieving encrypted data? I don't mean
Is it possible to store encrypted connection string so it can be used from
Is there any way to decrypt the encrypted MD5 string, given the key?
In my applications web.config file I have a connection string stored. I encrypted it

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.