Actually I am designing a project which requires searching of any binary string (like 010001..) from the list of binary strings of variable length. Can u please help me?|||Actually you can compute SHA1 hash of any binary data and compare the hashes.
http://us.php.net/manual/en/function.sha鈥?/a>
But if you prefer performance over accuracy, (collisions will be more) you should try CRC32() or CRC64().
This is a general set of solutions. You can find these functions in your programming language I guess.|||Sure, you can hash that. You just need to write a hash function that handles that. So... depending on how many strings you're going to have (let's say you might have 100 strings), you would want an array of size 50-100. This means your hash function should produce 50-100 different values, let's aim for 64. One thing might be to multiply your string by 97 (prime numbers produce fewer collisions), and take the last 7 bits as your hash code. You could handle collisions using a linked list (if you're using a language that supports it).
Hope that helps!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment