So I have encrypted records in my table and I would like to search these records. The problem is that when I do search and encrypt again my search term, it encrypts it again generating different, random string.
Is there a way to encrypt data so that when encrypting again the same data it would produce the same string as at the first time of encrypting?
Example: I'm using default settings for CI encryption library
$data = "ABC";
$stored_data = $this->encryption->encrypt( $data );
$search = "ABC";
$search_data = $this->encryption->encrypt( $data );
if( $search_data == $stored_data ){
var_dump("Found it");
}else{
var_dump("No results");
}
The above produces different random strings, so there is no way of searching encrypted data. Is there a solution to this kind of problem