# Why are the session keys in DHKE for different values of 'a' the same?

In a DHKE scheme with the a prime p = 467. an element g = 4. The element 4 has order 233 and generates thus a subgroup with 233 elements. after Computing the common key for A. a=400, b=134 B. a=167, b=134 the session keys are identical = 161

Can someone tell me the answer as to why the key is the same for both schemes given different values for a ?

Since $$\gcd(2,467)=1$$, one can observe using Fermat's little theorem that $$4^{233}\pmod{467}=2^{466}\pmod{467}=1$$.
$$g^{a_1}=4^{400}=4^{233+167}\equiv\underbrace{1\cdot4^{167}}_{=g^{a_2}}\pmod{467}=89.$$
This results into identical session keys (shared secrets) $$S=(g^a)^b=89^{134}\equiv161\pmod{467}$$.