Java tutorial
//package com.java2s; import java.math.BigInteger; public class Main { /** * Symmetric encryption of private key x * @param u * @param k * @param p * @param x * @return */ public static BigInteger getE(BigInteger u, BigInteger k, BigInteger p, BigInteger x) { return u.multiply(x).subtract(k).mod(p.subtract(BigInteger.ONE)); } }