*
*
* @throws KeyExchangeException
*/
protected void calculateExchangeHash() throws KeyExchangeException {
Hash hash;
try {
// Start a SHA hash
hash = new Hash("SHA");
} catch (NoSuchAlgorithmException nsae) {
throw new KeyExchangeException("SHA algorithm not supported");
}
int i;
// The local software version comments
hash.putString(clientId);
// The remote software version comments
hash.putString(serverId);
// The local kex init payload
hash.putInt(clientKexInit.length);
hash.putBytes(clientKexInit);
// The remote kex init payload
hash.putInt(serverKexInit.length);
hash.putBytes(serverKexInit);
// The host key
hash.putInt(hostKey.length);
hash.putBytes(hostKey);
// The diffie hellman e value
hash.putBigInteger(e);
// The diffie hellman f value
hash.putBigInteger(f);
// The diffie hellman k value
hash.putBigInteger(secret);
// Do the final output
exchangeHash = hash.doFinal();
}