Looks like the car wash enable situation all right. I would save the 24 bits (3 bytes) + 2-byte "minutes-per-day" + 2-byte "day-of-year" field. That's 7 bytes with a coupla bits unused for flags such as "discard after 24hrs" or "discard after 30 days", etc. I'd organize the field so that the DOY is first, followed by MOD. That way, discards more easily performed than with random searches. --Bob Russell McMahon wrote: >>A machine will have a mag swipe card reader. The cards are encoded with > > any > >>number between 0 and 10,000,000 representing an account number. When a > > card > >>is swiped i must store the card number, time and date - 9 byte chunks of >>data (24bit card number and 6bytes of date/time). When the card is swiped >>again i must recall the same information and can then delete it. > > > Answers so far sound good to me - hashing, B Tree, brute force memory > locations and more. > I assume this is for something comparable to a car wash system - you buy a > "ticket" which is recorded in the system and it is removed once utilised. > > I'd like to address another issue. You need to be really really really > confident of your data integrity here. With such a large number of potential > cards , if it is possible for one card to be read wrongly and thereby return > a valid code from another card, you are in deep trouble. Depending on what > the use of the card is this could be just customer annoyance (car washes) or > substantial expense (trying to find out where Elvis is inside the secure > area when he's already left the building.) You may not have control over the > encoding, but if you do, you want as much data integrity as you can get. > 10,000,000 potential numbers is binary 24 bits. You want to add at least a > 32 bit CRC to that, and possibly forward error correcting. > > > RM -- Replies: NOTE-Script, EXE,BAT and COM files will be rejected by server -------------- Bob Axtell PIC Hardware & Firmware Dev http://beam.to/baxtell 1-520-219-2363 -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics