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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:37:47+00:00 2026-05-27T11:37:47+00:00

So, I try to check if passwords match. This is the encryption I use,

  • 0

So, I try to check if passwords match.

This is the encryption I use, once when the data is inserted in the database, once to check if the inserted password on the login field matches the one from the database:

 byte[] pass = Encoding.UTF8.GetBytes(password);
 MD5 md5 = new MD5CryptoServiceProvider();
 string newPass = Encoding.UTF8.GetString(md5.ComputeHash(pass));

But every time I try to login (with correct details), it does not work. In the debugger, this is the string that comes from the database:

?]??$PL??f??6?

And the one encrypted from the login field:

�]��$PL��fඇ�6�

I suppose it’s an encoding problem, but can’t seem to figure it out myself.

  • 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-27T11:37:48+00:00Added an answer on May 27, 2026 at 11:37 am

    This line is inappropriate:

    string newPass = Encoding.UTF8.GetString(md5.ComputeHash(pass));
    

    ComputeHash returns arbitrary binary data. Either you should keep it as binary data, or if you do need to convert it to text, use Base64 to convert it in a way which will allow you to get back the original data later:

    string base64Hash = Convert.ToBase64String(md5.ComputeHash(pass));
    

    You should be fine to store that as a normal string – it’ll just be ASCII.

    (I wouldn’t personally use MD5 to hash passwords, but that’s a different conversation.)

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

Sidebar

Related Questions

This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check:
I have a form for changing passwords, it checks the password field for min_length
I want to try to use open id as login system on the site
I have a database containing usernames and passwords... I can understand how to check
I commit all my files into bitbucket. i try check in,revert file i deleted
What the heck does obstructed mean when you try to check into Subversion? I
try: spam.foo except AttributeError: do_somthing() (Is it wise to check an attribute like that
What test text do you try and type into your web forms to check
I try to make a registration form. When user post the fields, i check
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error

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.