Take the 2-minute tour ×  Is there any way to generate values
only between $0$ and $255$ with the Diffie-Hellman method? I
need to create keys for communication algorithms with $32$ and
$16$ numbers between that range.  The idea is to exchange the
keys between the participants using the results of the Diffie-
Hellman key agreement algorithm. Then we create the keys on the
clients side, so they can use the keys.  Letting $x$ be any
number, $$3^x \bmod 17 = W$$  $W$ can be any number between $0$
and $17$. I need $W$ to be a number between $0$ and $255$.
share|improve this question Can you expand a little bit on your
protocol? What are you planning to do with Diffie-Hellman? Are
you only going to use primes between 0 and 255? –  pg1989 Nov 9
'13 at 21:05 yes, i only need it to produce values between 0 and
255, the rest i have to find a way, but it isnt a problem, but
without this i cant do nothing –  JaimeASV Nov 9 '13 at 21:33
It's really unclear what you need here, can you explain it a
little more? –  pg1989 N