Blind Index Planning

CipherSweet includes a planner to assist developers in determining the safe sizes for an additional blind index on an encrypted field.

Using the planner is straightforward:

<?php
use ParagonIE\CipherSweet\Planner\FieldIndexPlanner;

# First, instantiate the planner for a given field
$planner = new FieldIndexPlanner();

# How many rows do you anticipate?
$planner->setEstimatedPopulation(50000);

# Next, add some information about existing fields
$planner->addExistingIndex('name_goes_here', 4, 16);
// ... etc.

$recommended = $planner->recommend();
var_dump($recommended);

This code snippet should yield the following:

array(2) {
  ["min"]=>
  int(4)
  ["max"]=>
  int(11)
}

In the above example, the existing index ("name_goes_here") has an output size of 4 bits and an input domain of 2^16 possible inputs (16 bits). That is where the 4 and 16 come from, respectively.

How to interpret this data:

If you make the additional index larger than 11, you introduce the risk of leaking data.

If you make it lower than 4, you'll have a lot of false positives and it really would not be worth creating this blind index.

If your additional index has a limited keyspace, you can pass the number of bits to the recommend() method to include this in the calculation.

Furthermore, you can use recommendLow() to only get the lower number, and recommendHigh() to only get the higher number.

Note: If there is no safe value for an additional index, the recommend methods will throw a PlannerException.

Next: Key/Backend Rotation