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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:29:35+00:00 2026-05-31T20:29:35+00:00

I got a string of an arbitrary length (lets say 5 to 2000 characters)

  • 0

I got a string of an arbitrary length (lets say 5 to 2000 characters) which I would like to calculate a checksum for.

Requirements

  • The same checksum must be returned each time a calculation is done for a string
  • The checksum must be unique (no collisions)
  • I can not store previous IDs to check for collisions

Which algorithm should I use?

Update:

  • Are there an approach which is reasonable unique? i.e. the likelihood of a collision is very small.
  • The checksum should be alphanumeric
  • The strings are unicode
  • The strings are actually texts that should be translated and the checksum is stored with each translation (so a translated text can be matched back to the original text).
  • The length of the checksum is not important for me (the shorter, the better)

Update2

Let’s say that I got the following string "Welcome to this website. Navigate using the flashy but useless menu above".

The string is used in a view in a similar way to gettext in linux. i.e. the user just writes (in a razor view)

@T("Welcome to this website. Navigate using the flashy but useless menu above")

Now I need a way to identity that string so that I can fetch it from a data source (there are several implementations of the data source). Having to use the entire string as a key seems a bit inefficient and I’m therefore looking for a way to generate a key out of it.

  • 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-31T20:29:36+00:00Added an answer on May 31, 2026 at 8:29 pm

    That’s not possible.

    If you can’t store previous values, it’s not possible to create a unique checksum that is smaller than the information in the string.

    Update:

    The term "reasonably unique" doesn’t make sense, either it’s unique or it’s not.

    To get a reasonably low risk of hash collisions, you can use a resonably large hash code.

    The MD5 algorithm for example produces a 16 byte hash code. Convert the string to a byte array using some encoding that preserves all characters, for example UTF-8, calculate the hash code using the MD5 class, then convert the hash code byte array into a string using the BitConverter class:

    string theString = "asdf";
    
    string hash;
    using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create()) {
      hash = BitConverter.ToString(
        md5.ComputeHash(Encoding.UTF8.GetBytes(theString))
      ).Replace("-", String.Empty);
    }
    
    Console.WriteLine(hash);
    

    Output:

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

Sidebar

Related Questions

I got a string from parsing a XML file which looks like this: Fri,
So basically I got string array, lets say a[i][b]; so the code looks something
I need to develop a template-like user control, which would accept any arbitrary content,
I've got a string like foo (123) bar I want to retrieve all numbers
Hi I'm struggling with some regex I've got a string like this: a:b||c:{d:e||f:g}||h:i basically
I'm splitting a potentially large string (let's say 20MB, though this is entirely arbitrary)
I got String like Wed, 08 Feb 2012 09:06:41 +0000. I want to fetch
I've got string like X los(2) - XYZ tres How I can find all
I would like to parse strings with an arbitrary number of parameters, such as
I got String from the database which have multiple commas ( , ) .

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.