paragonie/ciphersweet

Need some help on bindindex planning

mng4 opened this issue · 1 comments

mng4 commented

I have been through https://ciphersweet.paragonie.com/php/blind-index-planning over and over but since math was never a strong subject, I'm not able to understand how to calculate these two values addExistingIndex('birth_year_idx', **8**, **14**)

Let's say if I have a column named phone_number where there might be 100K records in next 10 years and each phone number may vary 12 to 15 digits, in that case how to do I calculate what should I put instead of 8 and 14?

You might have 100,000 records (6 digits). Each phone number is 12-15 digits long. You should select the smallest of these values.

To find out the bit size of 6 decimal digits, calculate the log base 2 of 10^6: https://www.google.com/search?client=firefox-b-1-d&q=lg%2810%5E6%29

So it works out to about 20 bits.