### 414-S11: questions and responses

If you ask a question that is of general relevance,
I'll add the question and a response at the end of this page.
Your name will be shown iff you ask for it.

**Question 1**
On the HW 3 solution part c, it says the answer is "yes". I don't understand
this answer because the "session key = enc(-k,nA+nB)" . Lets say thread 1
nA =5, nB = 3, then enc(-k,8). Then next time, nA=2,nB=6, then enc(-k,8).
Thus the same session key was used twice. Nothing in the code prevents this.
**Response**
random() means that the probability of this happening
is very small, effectively zero. To be precise, suppose
random can generate numbers in 0..N.
Consider two successive connection attempts,
with [xA,xB] in the first and [yA,yB] in the second.
Prob [xA+xB = yA+yB] decreases with N.
(You can calculate the probability as
number of pairs that equal K
divided by
number of possible pairs
The first is 2K (size of {[0,K], [1,K-1], ..., [K,0]}),
which is less than N.
The second is N*N.
So Probability is 1/N.
For 64-bit random numbers, N = 2**64.