Avatar of zoseri
zoseri
 asked on

hash function for binary code recognition...

We are scanning sheets that have binary codes printed onto them to map the sheets to other data (sheet IDs if you will).  There are a limited number of IDs, printed out as binary codes of up to 20 bits.  This is implemented as boxes of a certain size at specified x,y coordinates on the page.  So, for sheet ID 4, we
have the first 17 boxes showing up as blank areas on the page, followed by 1 black box, followed by blank areas for the last 2 boxes.
Never mind WHY we are doing this (we are cheapskates).  What we are trying to do now is to add another value that is a hash of the first value.  We are doing this to avoid doing the wrong thing when there is a problem in scanning.  There are cases for a variety of reasons where the ID is misidentified and we cannot prevent this from happening.  However, we can reduce the incidence of the wrong thing being done with the data by checking the hash value.  If the sheet ID and its hash value (printed on the page as additional boxes) do not match up, then we can say that we do not have enough confidence in the scanning to store the other sheet data at that sheet ID in the database and report this to the user.  This prevents us from overwriting existing data into the wrong place due to misrecognition of the sheet ID.

I am looking for a good hash function that will distribute the hash values well over the range of sheet IDs.  Since we are actually looking at binary information, we want to minimize similar bit patterns mapping to the same hash code.

It has been a while since I thought about anything like this and I was wondering if anyone had tried to do something similar and knew a good hash function for this specific case.  We are looking for 5 bit hashes mapping to the 20 bit sheet IDs

Thanks for any suggestions.
Algorithms

Avatar of undefined
Last Comment
BdLm

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ozo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
BdLm

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy