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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:24:29+00:00 2026-05-23T03:24:29+00:00

I’m looking for a way to identify data, such that I prevent it from

  • 0

I’m looking for a way to identify data, such that I prevent it from being loaded more than once in memory. I thought a good method of doing this is to create a hash for each data buffer and use that as a sort of an id.

The data that I’ll need to hash ranges from 8 kB images, to 40 kB animations, to 3–5 MB music files, to <0.5 MB sound files. What do you think is the best hashing algorithm for my case? For that matter, is hashing the data the way to go, or should I think of some other way to identify data?

  • 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-23T03:24:30+00:00Added an answer on May 23, 2026 at 3:24 am

    There are a number of strong algorithms in wide use:

    • sha512 (128 bytes)
    • sha384 (96 bytes)
    • sha224 (56 bytes)
    • sha1 and ripemd160 (40 bytes)
    • md5 (32 bytes) (like older md4 and md2)

    a weaker one
    * CRC (10 bytes)

    A general rule of thumb:

    • collision probability increases with the number of elements in your collections, not with their size
    • collision probability decreases with the number of bits in the checksum

    Hashing is the way to go. Just remember that for very very very large collections of items, you should consider the probability of getting a collision (i.e. use a hash lookup followed by a linear search by contents).

    As long as you seem to be storing files, it is probably nice to make a compound key:

    • hash of contents
    • file name
    • file length

    This has the following advantages:

    1. has collisions are off the table for all practical purposes because the chance of getting a collision for different data samples of the same length is enormously lower than the risk of getting a collision with just any data random samples
    2. your collection is immediately content addressable (meaning: you don’t need the filename to lookup the contents; you could use the content hash to scan for duplicates by another name, because the hash doesn’t depend on the name)

    $0.02

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.