I have implemented encryption for certain columns in a database. In some cases it may be necessary to search by these columns, either for exact matches or for substrings. At the moment, there is less than 10000 rows to search through (at most). However this will probably change in the future so I am anticipating efficency problems. 

The data will remain encrypted in the database, but when retrieved by the application, it can then be decrypted. This means that the retrieval does not have to be 100% accurate, it can retrieve more records than actually match the query, and the application itself can discard the non-matching records. 

With this in mind I came up with the following solutions:


For exact text match, hash the encrypted data and modulo this with a relatively low number (2^16 perhaps), and store that value in an additional column. When querying the database, it is only necessary to perform the same operation on the input string, and retrieve all records with matching hash value.
For finding substrings, hash each letter and mod 32 the result. Then set the corresponding bit in an integer. Perform the same operation on the query string. Thus it is only necessary to retrieve records where the result of a binary AND on the query with the stored value is greater than 0. This could also be done using each pair of letters, perhaps with a 64-bit or longer integer to allow for more records to be discarded.


My question is, would either of these techniques have a real impact on the security of the data in the encrypted columns? The encryption scheme is AES-256.


Question: Why does my bike make a noise when I pedal hard?
Answer: Could be any number of things.  The first thing to check (because ignoring it can rapidly cause expensive damage) is that the crank arms are tight.  Even if they don't seem loose it doesn't hurt to put a wrench on the fixing bolts and torque them a bit.  (If one moves more than a small amount, get a torque wrench and do them up right.)  Likewise with the pedals.

You can also get noise from a cartridge BB if the cups are not totally tight. No big emergency here, but you need to tighten them to see if that's the problem.

Spokes can make a "ting" sound, especially if the wheel is relatively new.  Unless there are loose spokes, though, there's not much you can do about this and it will usually go away on its own after the wheel breaks in.

It's unlikely to be that the BB needs lube, unless it's been sorely neglected for years (or submerged in Sandy's tidal waters).

If the bike is relatively new (a few months old), you should take it back to the shop where you bought it and ask for a "tuneup" where they would tighten the crank arms, adjust the brakes and shifters, and true up the wheels.  On a new bike they should do this for free or for a nominal sum.

If the bike's older a tuneup won't hurt, but expect to pay more.