Sunday, January 5, 2014

Complexity of functions and their inverses

I'm interested in the question of trapdoor functions. I want to get a general idea of how common it is to have a function that is easy to calculate, whose inverse is difficult to calculate.

Before I go any further, I want to point out that in this blog post I'm only talking about calculating functions as polynomials. It's possible that a function that is difficult to calculate as a polynomial (using multiplication and addition as primitives) could be easy to calculate using other operators (like XOR, SHIFT, or exotic operators we've never used before). In another post I'll outline the parameters that I believe cover every possible set of primitives for modular calculations.

But for now, I'm just talking about traditional modular polynomials. For a set of invertible functions with inputs and outputs in ZP, what is the relationship between the complexity of the function and the complexity of its inverse?

For the purpose of this short post, I've looked at P=5 and invertible functions f(x,y) with an inverse g(x,z) such that g(x, f(x, y)) = y. Note that I am not looking for the commutative property that f(f(x, y), z) = f(f(x, z), y).

I'm measuring the complexity of each function as a measure of the estimated processing time for its polynomial, counting the number of terms minus one plus the sum of all of the exponents. (That is, counting the number of additions and multiplications required). So, for example, 3x4y2 + 17y would have a complexity if 2 terms - 1 + 4 + 2 + 1 = 8, reflecting the 7 multiplications and one addition.

In Z5 there are a total of 552 = 298,023,223,876,953,152 functions that take two parameters. Of these, (5!)5 = 24,883,200,000 are invertible as I described. All I have is a little laptop and a few hours here and there, so I can't even conceive of exploring this entire function space exhaustively.

For this short post, I took 1000 random samples from the function space for testing. It turns out that the complexity of every function was exactly the same as the complexity of its inverse. 799 of the samples had a complexity of 124, and 199 of the samples had a complexity of 123. Two samples had a complexity of 115.

So, when treated as polynomials, a function and its inverse seem to require the same processing time.

No comments:

Post a Comment