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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:09:05+00:00 2026-06-05T08:09:05+00:00

When obtaining the hash code of a string using the GetHashCode() method is there

  • 0

When obtaining the hash code of a string using the GetHashCode() method is there any chance that it can return zero or does the algorithm used guarantee otherwise?

The reason I’m asking is that I have a use case where I need to invent a hash for a null string and I was thinking of using zero rather than hashing some constant string. If I do this how likely am I to get a collision (barring the obvious fact that collisions are always possible)

  • 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-05T08:09:06+00:00Added an answer on June 5, 2026 at 8:09 am

    There’s no way to definitively answer that. The behavior of String.GetHashCode() is documented as being undefined and subject to change between framework versions and to be different between 32bit and 64 bit systems.

    If you chose some other value you may be just as likely to have a collision. Zero would be a pretty reasonable default.

    The Nullable.GetHashCode() returns 0 if it stores a null value so return a hash code for zero has some precedent.

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

Sidebar

Related Questions

Is there any method of obtaining the name of the file uploaded to a
Is there any possibility in obtaining information about the hand which holds the kinect
I am trying to identify a method for obtaining nearby wifi access points using
I've noticed that whatever method I use for obtaining the current requests URL, the
Is there a standard value for (or method for obtaining) epsilon in Python? I
I am obtaining data from a database that is returned in an XML string.
is there a way of obtaining cover art for a soundtrack? My app can
Are there any tips, tricks or methods for obtaining profiling/logging/debug information on the runtime
Apparently an alternative method (to just using the extended Euclidean algorithm) of obtaining the
I am obtaining the mac(hw) address of an interface using CWNetwork. Now OS X

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.