232233234235236237238239240241242
try { // Generate the key using the passphrase Hash md5 = new Hash("MD5"); md5.putBytes(passphrase.getBytes()); byte[] key1 = md5.doFinal(); md5.reset(); md5.putBytes(passphrase.getBytes()); md5.putBytes(key1); byte[] key2 = md5.doFinal();
237238239240241242243244245246247
byte[] key1 = md5.doFinal(); md5.reset(); md5.putBytes(passphrase.getBytes()); md5.putBytes(key1); byte[] key2 = md5.doFinal(); byte[] key = new byte[32]; System.arraycopy(key1, 0, key, 0, 16); System.arraycopy(key2, 0, key, 16, 16); return key;
6667686970717273747576
public String getFingerprint() { try { Hash md5 = new Hash("MD5"); md5.putBytes(getEncoded()); byte[] digest = md5.doFinal(); int bits = getBitLength(); bits = (((bits % 8) != 0) ? (bits += (bits % 8)) : bits); String ret = String.valueOf(bits);
11031104110511061107110811091110111111121113
// Put the exchange hash in again hash.putBytes(sessionIdentifier); // Create the fist 20 bytes data = hash.doFinal(); keydata.write(data); // Now do the next 20 hash.reset();
11171118111911201121112211231124112511261127
// And the exchange hash hash.putBytes(exchangeHash); // Finally the first 20 bytes of data we created hash.putBytes(data); data = hash.doFinal(); // Put it all together keydata.write(data); // Return it
306307308309310311312313
// The diffie hellman k value hash.putBigInteger(secret); // Do the final output exchangeHash = hash.doFinal(); } }
238239240241242243244245246247248
233234235236237238239240241242243
6768697071727374757677