anchor.diff:      U = bin_to_int(crypto:hash(sha, [int_to_bin(ClientPublic), int_to_bin(ServerPublic)])),
       X = get_user_hash(User, Pass, Salt),
       GX = bin_to_int(crypto:mod_pow(get_generator(), X, get_prime())),
  -    KGX = (get_k() * GX) rem get_prime(),
  -    Diff1 = (ServerPublic - KGX) rem get_prime(),
  -    Diff = if Diff1 < 0 -> Diff1 + get_prime(); Diff1 >= 0 -> Diff1 end,
  +    KGX = remainder(get_k() * GX, get_prime()),
  +    Diff = remainder(ServerPublic - KGX, get_prime()),
       UX = (U * bin_to_int(X)) rem get_prime(),
       AUX = (ClientPrivate + UX) rem get_prime(),
       SessionSecret = crypto:mod_pow(Diff, AUX, get_prime()),
  
positive.code: server_seed(V) ->
      PrivateKey = get_private_key(),
      GB = bin_to_int(crypto:mod_pow(get_generator(), PrivateKey, get_prime())),
      KV = (get_k() * V) rem get_prime(),
      PublicKey = (KV + GB) rem get_prime(),
      {PublicKey, PrivateKey}.
  
  %% client session key
  
negative.code: get_k() ->
      1277432915985975349439481660349303019122249719989.
  
  -spec remainder(integer(), integer()) -> integer().
  remainder(A, B) ->
      Rem = A rem B,
      if Rem < 0 -> Rem + B; Rem >= 0 -> Rem end.
  
  %% x = H(salt, H(username, :, password))
  -spec get_user_hash(binary(), binary(), binary()) -> binary().
  