2
$\begingroup$

You have a 4 number long PIN code with each number ranging from 0 to 9 which you wish to encrypt. You are then given a random 4 digit number ranging from 0 to 9999, which when added to the original PIN should give out a perfectly secure encrypted number.

Now clearly, just adding the two numbers would give an uneven distribution (a Gaussian curve), as if for example the PIN was 0000 and the random number was 0001, you can rest assured that the original PIN is either 0000 or 0001, while if both integers add up to 9999, there are 19998 possible outcomes.

So my initial thought was that applying the mod of 10000 (because there are 10000 possible combinations) to the sum should ensue an even distribution, making this encryption scheme perfectly secure. Now I honestly really don't know how to prove this, but my main question is how can you convert this somewhat meaningless number back to the original PIN? Is this actually (maybe not effective) perfectly secure? The point of this exercise is that the two users only have common knowledge of the random number, so I don't think any modulus exponent tricks are accessible.

$\endgroup$
7
  • 4
    $\begingroup$ Smells like homeworks to me. :/ Fist advice : simplify your scheme. I.e. think each digit separately => consider a only 1 number long PIN code. Second hint : if a + b = c, if you know b and c, how do you find a (it works with mod too)? $\endgroup$
    – Biv
    Apr 4, 2016 at 16:37
  • 3
    $\begingroup$ 3rd and last hint, you do not need exponents. Your scheme is perfectly secure as is (using the modulus). You just need to prove it. And yes here comes the probabilities... $\endgroup$
    – Biv
    Apr 4, 2016 at 16:44
  • 4
    $\begingroup$ Have you considered carry-less addition of the individual digits? This would be comparable to exclusive-or in base-2. $\endgroup$
    – user9070
    Apr 4, 2016 at 18:13
  • 1
    $\begingroup$ @AndresStadelmann Well, its not that they are not welcomed, it is just that 1. it is rarely useful to someone else. 2. If we give the answer you won't learn anything and it will sap the work of a teacher. :) So the best you could expect is some advices or hint. However is the question is not too specific, asking won't hurt. And no you don't need to remove it. In a worse case scenario, it will get down voted/closed and will get removed automatically in some months. $\endgroup$
    – Biv
    Apr 4, 2016 at 18:33
  • 1
    $\begingroup$ Our usual policy concerning homework is that you document your efforts and depending on how far you have come we'll usually guide you towards the correct result or fix flaws in your thought process which allows you to come to the solution yourself, which is a) more satisfying for you and b) more effective as a means of learning. $\endgroup$
    – SEJPM
    Apr 4, 2016 at 19:24

3 Answers 3

1
$\begingroup$

Your idea of addition modulo 10000 is correct. The correctness follows from the fact that $\mathbb{Z}_{10000} = \{0, 1, \dots, 9999\}$ equipped with addition modulo $10000$ forms a (finite) group.

Let $m \in \mathbb{Z}_{10000}$ denotes a PIN code. Now choose a uniformly random element $r \in \mathbb{Z}_{10000}$ and define $c = m + r \bmod 10000$. It is easily seen that $c$ is a uniformly random element in $\mathbb{Z}_{10000}$.

$\endgroup$
0
$\begingroup$

Add the two numbers, and keep only the lower 4 digits. To reverse, add 10000 then subtract the second number and keep only the lower 4 digits again. Works like a charm.

$\endgroup$
-1
$\begingroup$

Expand the key using a pseudo random generator and then add each digit mod 10 together, similar to Vigenère cipher and OTP.

$\endgroup$
2
  • 1
    $\begingroup$ Your answer does not fit the constraints of its question: the message is 4 digit long, hence yes it is perfectly secure. "each digit together" $\mapsto$ far too informal: Lets say that you have 1234, if you add each digit together you get 10. I'm pretty convinced this is not what you want to say. :) $\endgroup$
    – Biv
    Apr 5, 2016 at 11:45
  • $\begingroup$ Oh write, didnt read it properly, dont add like that, add mod 10. And it is perfect security, but i dont know why you would bother. $\endgroup$ Apr 13, 2016 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.