final BigInteger b = ((SRPPrivateKey) serverKP.getPrivate()).getX();
// compute u = H(A | B)
// IMessageDigest hash = srp.newDigest();
// IMessageDigest hash = HashFactory.getInstance(md);
final SRP srp = SRP.instance(md);
final IMessageDigest hash = srp.newDigest();
byte[] buffy;
buffy = Util.trim(A);
hash.update(buffy, 0, buffy.length);
buffy = Util.trim(B);
hash.update(buffy, 0, buffy.length);
final BigInteger u = new BigInteger(1, hash.digest());
// compute S = ((A * (v ** u)) ** b) % N
final BigInteger S1 = A.multiply(v.modPow(u, N)).modPow(b, N);
// compute K = H(S) (as of rev 08)
final byte[] s1Bytes = Util.trim(S1);
hash.update(s1Bytes, 0, s1Bytes.length);
final byte[] K1 = hash.digest();
final BigInteger x = new BigInteger(1, srp.computeX(salt, user, password));
// compute S = ((B - (3 * (g ** x))) ** (a + (u * x))) % N
// compute S = ((B - (3 * v)) ** (a + (u * x))) % N
final BigInteger S2 =
B.subtract(BigInteger.valueOf(3L).multiply(v))