# Multiplication encryption with a small number

Given a big number $$x$$(1024 bits) and a large prime $$N$$($$N>x$$), I want to encrypt it with a smaller number $$y$$(128 bits).

$$Enc(x) = xy \mod{N}.$$

Is it safe? If not, how do I evaluate its leakage?

The most basic security is "Indistinguishability in the presence of an eavesdropper". This is based on a simple experiment. An adversary $$A$$ sends two messages $$m_0$$, $$m_1$$ to a challenger $$C$$. The challenger encrypts one of the messages (randomly chosen, say $$C$$ chooses $$b \in \{0,1\}$$ uniform random and encrypts $$c_b = Enc(m_b)$$). The ciphertext is then send to $$A$$. The adversary now has to find out, which message was encrypted and sends $$b'=0$$ or $$b'=1$$ to $$C$$. If $$b = b'$$ we say $$A$$ wins.
Now we look at your Encryption: $$A$$ knows $$Enc(x)$$ and $$x$$. With the extended euclidean algorithm $$A$$ can compute $$y$$ and therefore can distinguish $$c_b$$. So $$A$$ wins the experiment and the Encryption system does not even provide the most basic concept of security.
• $A$ knows $\operatorname{Enc}(x)$, but no justification is given that $A$ knows $x$. $A$ knows $x\in\{m_0,m_1\}$, but it is not told how it is determined whether $x=m_0$ or $x=m_1$. In some cases, there is no possible advantage, e.g. with $m_0=1$, $m_1=2$, and it happens that the key $y=3-x$: for both $b$, $\operatorname{Enc}(x)=2$. – fgrieu Apr 13 at 9:16
• When $Enc(x)$ and $x$ are given, $y$ can be computed. However, gettng $Enc(m_b)$, using $m_0$ and $m_1$ respectively, you can compute different $y_1$ and $y_2$. How do you know which one is right? – Wanyu Apr 13 at 9:22