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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:55:35+00:00 2026-06-13T03:55:35+00:00

Need to get MD5 hash from string. Get an error MD5 is null. I

  • 0

Need to get MD5 hash from string.
Get an error MD5 is null.
I am tying to get a 32 character MD5 hash from a string.

using (System.Security.Cryptography.MD5 md5 = 
       System.Security.Cryptography.MD5.Create("TextToHash"))
{
    byte[] retVal = md5.Hash;
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < retVal.Length; i++)
    {
        sb.Append(retVal[i].ToString("x2"));
    }
}
  • 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-06-13T03:55:36+00:00Added an answer on June 13, 2026 at 3:55 am

    Need to get MD5 hash from string.

    Then first you need to convert your string to binary data in some form. How you do that will depend on your requirements, but it’ll probably be Encoding.GetBytes for some encoding… you need to work out which encoding though. Does this hash need to match the hash created somewhere else, for example?

    Get an error MD5 is null.

    That’s because you’re using MD5.Create incorrectly. The argument is an algorithm name. You should almost certainly just use the parameterless overload instead.

    I suspect you want something like:

    byte[] hash;
    using (MD5 md5 = MD5.Create())
    {
        hash = md5.ComputeHash(Encoding.UTF8.GetBytes(text));
    }
    // Now convert the binary hash into text if you must...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: I need to COMPARE if a string is a MD5 Hash in SQL.
We have an embedded resource and need to get the md5 hash of the
I need get all items these have no categories int? categoryId = null; var
I need to get the contents from this URL http://google.fr/ok in a NSString can
Possible Duplicate: In C++, How to get MD5 hash of a file? I am
I want to get 64 bit hash code of given string. How can i
Due to an absurd SOAP authentication scheme I need to md5 hash an API
Using md5 on a string always produces an alpha-numeric encrypted result, ie: no symbols.
In my project i need to get the MD_5 hash code of the file
I need get the id of an images which is place inside a datatemplate..

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.