Diffie-Hellman using a different modulus on both sides For Diffie-Hellman Key Exchange, the used modulus is the same throughout the process. Is it possible to use 2 different for both sides? For example, 


$A \gets M^{d_1} \pmod{n_1} $
$B\gets M^{d_2} \pmod{n_2} $
$m \gets B^{d_1} \pmod{n_1} $
$m' \gets A^{d_2} \pmod{n_2} $ &lt;-- I wonder if $m'$ is equal to $m$ as well? 


Put 1 into 4; put 2 into 3, then

$$(M^{d_1} \;(\bmod{n_1}))^{d_2} \pmod{n_2} \equiv (M^{d_2} \;(\bmod{n_2}))^{d_1} \pmod{n_1} $$

Please kindly help if my concept is correct? Thanks!
I see you use the same generator on both sides (this need not work for any $n_1, n_2$ of course...). But even if this holds (trying a small example):

Let 1 use $n_1 = 11, M=2$, and 2 uses $n_2 = 13, M= 2$. Check that $2$ is a generator for both of the multiplicative groups.

If $d_1 = 7, d_2 = 9$, then $A = 2^7 \bmod 11 = 7$, while $B = 2^9 \bmod 13 = 5$.

But $5^7 \bmod 11 = 3$ which does not equal $7^9 \bmod 13 = 8$.