According to [DJN 10], the plaintext space is Z_n. We had this information in the Encrypt and EncryptWithR documentation but sometimes, when encrypting result of more complex equations, it's easy to miss the fact their result is out of the allowed range.
Here we have just a safety check making sure that if plaintext is out of the allowed space, we report an error.
To better illustrate why it does not make sense to allow encrypting values out of Z_n, let's use a simple example for n = 143:
m = -141 -> D(E(m)) = 0
m = -142 -> D(E(m)) = 0
m = -143, -> D(E(m)) = 0
m = -144 -> D(E(m)) = 0
m = -145 -> D(E(m)) = 0
we can't restore the original value of m.
Now for positive integers:
m = 141 -> D(E(m)) = 141
m = 142 -> D(E(m)) = 142
m = 143 -> D(E(m)) = 0
m = 144 -> D(E(m)) = 1
m = 145 -> D(E(m)) = 2
We can restore the original message for m < n (143) but for m > 143 we can't really go back to the original value. If we allow for any positive m, D(E(m)) = 1 means that m is either 1 or it's m = nk + 1 for any positive k. Since we can't restore the original message unambiguously, allowing for m >=n does not make sense.
[DJN 10]: Ivan Damgard, Mads Jurik, Jesper Buus Nielsen, (2010)
A Generalization of Paillier’s Public-Key System
with Applications to Electronic Voting
Aarhus University, Dept. of Computer Science, BRICS
According to [DJN 10], the plaintext space is `Z_n`. We had this information in the `Encrypt` and `EncryptWithR` documentation but sometimes, when encrypting result of more complex equations, it's easy to miss the fact their result is out of the allowed range.
Here we have just a safety check making sure that if plaintext is out of the allowed space, we report an error.
To better illustrate why it does not make sense to allow encrypting values out of `Z_n`, let's use a simple example for `n = 143`:
```
m = -141 -> D(E(m)) = 0
m = -142 -> D(E(m)) = 0
m = -143, -> D(E(m)) = 0
m = -144 -> D(E(m)) = 0
m = -145 -> D(E(m)) = 0
```
we can't restore the original value of `m`.
Now for positive integers:
```
m = 141 -> D(E(m)) = 141
m = 142 -> D(E(m)) = 142
m = 143 -> D(E(m)) = 0
m = 144 -> D(E(m)) = 1
m = 145 -> D(E(m)) = 2
```
We can restore the original message for `m < n (143)` but for `m > 143` we can't really go back to the original value. If we allow for any positive `m`, `D(E(m)) = 1` means that `m` is either `1` or it's `m = nk + 1` for any positive `k`. Since we can't restore the original message unambiguously, allowing for `m >=n` does not make sense.
[DJN 10]: Ivan Damgard, Mads Jurik, Jesper Buus Nielsen, (2010)
A Generalization of Paillier’s Public-Key System
with Applications to Electronic Voting
Aarhus University, Dept. of Computer Science, BRICS
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
According to [DJN 10], the plaintext space is
Z_n. We had this information in theEncryptandEncryptWithRdocumentation but sometimes, when encrypting result of more complex equations, it's easy to miss the fact their result is out of the allowed range.Here we have just a safety check making sure that if plaintext is out of the allowed space, we report an error.
To better illustrate why it does not make sense to allow encrypting values out of
Z_n, let's use a simple example forn = 143:we can't restore the original value of
m.Now for positive integers:
We can restore the original message for
m < n (143)but form > 143we can't really go back to the original value. If we allow for any positivem,D(E(m)) = 1means thatmis either1or it'sm = nk + 1for any positivek. Since we can't restore the original message unambiguously, allowing form >=ndoes not make sense.[DJN 10]: Ivan Damgard, Mads Jurik, Jesper Buus Nielsen, (2010)
A Generalization of Paillier’s Public-Key System
with Applications to Electronic Voting
Aarhus University, Dept. of Computer Science, BRICS