Score:2

Entropy of SIM PIN code

at flag

Each mobile SIM card has a four-digit number ($b_1$,$b_2$,$b_3$,$b_4$) called PIN code. Each digit $0 \le b_i \le 9$ (for i = 1, 2, 3, 4) is generated using a random 16-bit sequence as follows: $b_i=(r_{4i-3} + r_{4i-2} .2 + r_{4i-1}.2^2 + r_{4i}.2^3)\pmod {10} $. How we can calculate the antropy of PIN code? I know the entropy relation but I have no view.

kelalaka avatar
in flag
Clearly HW, What have you tried?
Score:1
cn flag

I'm calling here $B_1, B_2, B_3, B_4$ the four random variables representing the four digits (I do not like to call a variable $p$). It seems a good idea to compute the entropy of only $1$ digits, and then because the four digits are independently chosen, we could multiply this number by $4$. Let $q_i= \mathbb{P}(B_1 = i)$ for any $i \in\{0, \dots, 9\}$. $$H(B_1)= -\sum_{i=0}^9 q_i\log(q_i)$$.

You can notice for $0\leq j \leq 5$, $q_j =\frac{2}{16}$, and for $6\leq j\leq9$, $q_j= \frac{1}{16}$. Then, because $\log_2(\frac{2}{16})= (1-4)$, and $\log_2(\frac{1}{16})= (-4)$. \begin{align} H(B_1)&= -\left(6\cdot \frac{2}{16}(1-4) + 4\cdot \frac{1}{16}(-4)\right) \\ &=\frac{9+4}{4}= \frac{13}{4} = 3.25 \end{align}

After multiplying by $4$, because there is $4$ digits (as I've said before), we obtain $13$ bits of entropy.

Paul Uszak avatar
cn flag
Just looking at this. Are you convinced that $p_i$ is smooth and continuous? There are no gaps? And are they IID; they come from a formula...
Ievgeni avatar
cn flag
I've deleted one sentence does it make more sense for you?
Paul Uszak avatar
cn flag
Oh I'm not criticising. I'm suspicious of the formulation of $p_i$. I am of all constructs that have implications for the security services. Four truly random digits have H = 13.3 bits ($\log_2(10) \times 4$). Seed $r$ is 16 bits. 16 > 13.3, so why not directly use $r$ and rejection sample down? It whiffs.
kelalaka avatar
in flag
Nobody generates such probabilistic random pins. HW.
fgrieu avatar
ng flag
Since this is homework, I will let it to the OP to fix a slight error.
Ievgeni avatar
cn flag
I've corrected the error...
kelalaka avatar
in flag
Still, there is a mistake from first-class of rational numbers.
Mohammadsadeq Borjiyan avatar
at flag
Dear Paul Uszak, thank you for your consideration. Yes, this scheme in comparison to a four-digit random number is some unreasonable, but the purpose was comparison of the entropy of two designs.
Mohammadsadeq Borjiyan avatar
at flag
Dear levgeni, I was very thankful you are considering my problem.
fgrieu avatar
ng flag
For comparison: a uniformly random 10-digit PIN has ≈13.2877 bit of entropy, and generating the PIN by reducing the 16-bit value modulo 10000 yields ≈13.2835 bit of entropy.
Paul Uszak avatar
cn flag
I repeat: are these values independently distributed? If not, the entropy will be (much) lower. Some Python is required.
Score:0
at flag

For $0 \le b_i \le 5$, $p_i=\frac{2}{16}$ and for $6 \le b_i \le 9$, $p_i=\frac{1}{16}$. Then we calculate the logarithm values, which are respectively equal to $\log_2(\frac{2}{16})=(1-4)$ and $\log_2(\frac{1}{16})=(-4)$. Now, according to the entropy relation, \begin{align} \ H(b_1) &= -\ \sum_{i=0}^{9} p_i \log_2(p_i ), \end{align} we will have:

\begin{align} \ H(b_1) &= \ -(6 \cdot \frac{2}{16}(1-4) + 4 \cdot \frac{1}{16}(-4))=3.25, \end{align} which is the entopy of one digit. As there are four independent digits, multiply the value by 4 and we get 13 bits of entropy.

fgrieu avatar
ng flag
Watch the sign, and the exclusion of indices $j$ with zero probability. It's $H(b_1)=\displaystyle\sum_{j=0\ldots9\text{ and }p_j>0}p_j \log_2(1/p_j)$ or equivalently $H(b_1)=-\displaystyle\sum_{j=0\ldots9\text{ and }p_j>0}p_j \log_2(1/p_j)$.
kelalaka avatar
in flag
@fgrieu on the right, do you mean $\log_2(p_j)$? This comment shouts: delete me if I'm correct.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.