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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:06:44+00:00 2026-05-26T22:06:44+00:00

Possible Duplicate: How do I create a HashCode in .net (c#) for a string

  • 0

Possible Duplicate:
How do I create a HashCode in .net (c#) for a string that is safe to store in a database?

I use C# 4.0 and gets the string hash by invoking:

"my string".GetHashCode()

Code generated by this call is stored into database to future use. This hash code is used to find some subset of strings and then to equal comparison.

Questions are:

  1. Is it a standardized hash calculation? May I assume that it is
    possible to calculate the same hash in different environments like C# in .Net 3.0 or future .Net editions?
  2. Is it possible to calculate the same hash function on yourself by writing it in Java, PL/SQL, Ruby, etc?
  3. Can I assume that hash generated today will be the same tomorrow in
    the same environment? For example when I shutdown my computer and
    run the program again, or change locale, or some other settings?
  4. What are the limits of portability?
  5. I know I can do it yourself, but maybe some kind of portability is provided?
  • 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-26T22:06:45+00:00Added an answer on May 26, 2026 at 10:06 pm

    From MSDN:

    The default implementation of the GetHashCode method does not guarantee unique return values for different objects. Furthermore, the .NET Framework does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of the .NET Framework. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.

    So no, you cannot assume that the value produced by GetHashCode is stable. This isn’t just theoretical, either – we’ve seen the value change in the past.

    If you want a stable hash, you’ll have to generate it yourself.

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

Sidebar

Related Questions

Possible Duplicate: Create a variable in .CSS file for use within that .CSS file
Possible Duplicate: How do I create a random alpha-numeric string in C++? I need
Possible Duplicate: Create a date with T-SQL I've a data table that stores each
Possible Duplicate: How do I create a view that stays onscreen while I switch
Possible Duplicate: Create WPF TextBox that accepts only numbers How i can check if
Possible Duplicate: Create an Iframe from a Drupal Website I'd like to use an
Possible Duplicate: How can I create a UIColor from a hex string? I want
Possible Duplicate: Merging .net managed dlls I create a test project in which I
Possible Duplicate: Create a usercontrol instance programmatically in ASP.NET Dear Friend i have the
Possible Duplicate: Create a UIViewController that contain a UIViewController I have a parent view

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.