# Key-space analysis of an algorithm

I have an algorithm that requires a set of keys to encrypt a text (image of size N x N). It is an image encryption algorithm for a project. The key can be thought of as a tuple

$$x_0, \lambda, d, i, j, DF, U$$

where:

• $$0 < x_0 < 1$$;
• $$3.57 \leq \lambda \leq 4$$,
• $$15 \leq d \leq \infty, 1 \leq i \leq \infty, 1\leq j \leq \infty$$
• $$1E8 < DF < 1E9$$
• $$U$$ is any random $$4 \times 4$$ matrix.

If this is my parameter set, how can I calculate the key-space of the algorithm?

• can you define which parameters are publicly known as part of the key? Because if the $\lambda$ is a floating point number, mathematically (not programmatically) you have already reached infinity. If not specify your floating point mantisa. – kelalaka Oct 3 '18 at 7:46
• Floating point precision is $10^{-14}$, i am working on Matlab – user311790 Oct 3 '18 at 7:48
• The keyspace can be determined with knowledge of both the internal floating point format and the external representation of key, typically as characters. But beware that cryptography with floating is often flawed; see this. It tends to produce implementation-dependent results, and to be next to impossible to analyze from a security standpoint. One of few exceptions is cryptography using floating point to perform exact integer arithmetic, like some implementations of poly1305. – fgrieu Oct 3 '18 at 8:09
• The other issue with using floating point values as the key is "what if the value the attacker guesses is 'close'; does that mean that the decrypted value is also 'close'"? If so, that both reduces the key space (as also allows potential attacks where the attacker tries various guesses at the key, and learns when he is getting "warm") – poncho Oct 3 '18 at 11:42
• @user311790 Actually, precision changes with the size of the number that's floating. See the precision graph in my answer @ crypto.stackexchange.com/a/47022/23115. – Paul Uszak Oct 3 '18 at 16:00