Sorting encrypted data without decryption: a practical trick
github.com·11h·
Discuss: DEV

TL;DR: I sort encrypted strings using an external index: the sum of weighted Unicode code points for the first N characters with exponential positional weights, followed by quantization. Monotonicity is preserved, but accuracy predictably degrades after the first few characters. Not a cryptographic scheme; some ordering information leaks by design.

The essence of the problem

Some time ago, while implementing a project, I ran into the problem of sorting encrypted data in a database. I’d like to share the solution.

I won’t go into detail describing the entire application. I'll just say that, according to the required architecture, almost all data in the database must be stored exclusively in encrypted form: usernames, f...

Similar Posts

Loading similar posts...