PDA

View Full Version : Hash functions



Ioannis
- 4th March 2005, 09:11
In a project I will use some iButton keys like DS1922 for access control. I prefer to use a stand alone PIC with EEPROM memory to store the keys in.

If the keys are more that, say, 20 then the search time increses to much. Does anyone have any experience with Hash Functions to code the unique iButton serial number into a memory address to find it then instantly?

Thanks,
Ioannis

BobEdge
- 4th March 2005, 16:13
Hi

If your using a 4MHz osc you could try using 20MHz, that would be 5 upto times faster, depending on the commands used.

Regards
Bob...

Dwayne
- 4th March 2005, 17:25
Hello Ioannis,

I>>Does anyone have any experience with Hash Functions to code the unique iButton serial number into a memory address to find it then instantly?<<

Ouch...Unless you can use a "function" to calculate your address directly, you are talking about time. Some Hashing routines use functions as such. The other Hash routines will probably require more time in calculating , then it would be to read the data and compare. How many items will you have?

Can you store them in a ASCII logical order and do a Binary Search routine?
This will limit your number of reads down. if you have 256 items (like in a table) you would find (worse case senario) 8 reads to have your value.

Dwayne

Ioannis
- 5th March 2005, 19:12
Thanks for the replies.

Well a 20 MHz xtal is not the best since speeding up to 5 times is not enough. There will be an incresing number of keys and may reach up to 300 or 400. Imagine a PIC searching 400 6-8 byte numbers!!!

The binary tree is a good option. Did not think about it.

Thanks again.

Ioannis