paragonie / ciphersweet

Fast, searchable field-level encryption for PHP projects
https://ciphersweet.paragonie.com
Other
437 stars 32 forks source link

How to do a string search? #20

Closed OmegaZero closed 6 years ago

OmegaZero commented 6 years ago

The documentation provides an example for how to do a search on the last four of the SSN, but how do you setup a string search? For something like a last name where the length could be variable - an example would be nice to see.

Thanks!

paragonie-scott commented 6 years ago

Check the examples directory. We have complete examples there.

On Sun, Sep 16, 2018, 2:07 PM OmegaZero notifications@github.com wrote:

The documentation provides an example for how to do a search on the last four of the SSN, but how do you setup a string search? For something like a last name where the length could be variable - an example would be nice to see.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paragonie/ciphersweet/issues/20, or mute the thread https://github.com/notifications/unsubscribe-auth/ALDfXqE_zA7_g_7F1jBbwxXbJtBBHlQ-ks5ubpNHgaJpZM4Wq9_Q .

OmegaZero commented 6 years ago

Unless I'm looking in the wrong place the only example I can see if the SSN example I mentioned before...?

paragonie-scott commented 6 years ago

Can you please clarify what you mean by "string search"?

Blind indexes can only be created on:

The LastFourDigits in our code is an example of the transformation. You could also do one where, given a user's full name, you index strtolower($firstName[0] . $lastName).

This doesn't support wildcards or regular expressions. You'd need a crazy academic scheme for full text searching an encrypted database.

OmegaZero commented 6 years ago

Ah ok I misunderstood the potential (and wasn't sure how it was done to begin with - makes sense now :) )

I'll just limit it to searching on the first letter of the last name, thanks!

paragonie-scott commented 6 years ago

No problem at all. I'm going to tag this as a documentation issue since it could be made clearer.

paragonie-scott commented 6 years ago

I've updated the README to make this a bit clearer. Thanks for your feedback. :)