<<  Algebra`FiniteFields`
Prime[Range[10]]

p = Prime[5]

PowerList [GF[p, 1]]

g = PowerList [
          GF[p, 1]][[2]]

xA  =  Random[Integer, p]
xB  =  Random[Integer, p]

yA  =  PowerMod[g, xA, p]
yB  =  PowerMod[g, xB, p]

kA  =  PowerMod[yB, xA, p]
kB  =  PowerMod[yA, xB, p]