public MessageDigest getStrongestMessageDigest ( ) { if ( digestExists ( "SHA-512" ) && caps . contains ( Capability . SHA_512 ) ) { return getDigest ( "SHA-512" ) ; } else if ( digestExists ( "SHA-256" ) && caps . contains ( Capability . SHA_256 ) ) { return getDigest ( "SHA-256" ) ; } else if ( digestExists ( "SHA-1" ) && caps . contains ( Capability . SHA_1 ) ) { return getDigest ( "SHA-1" ) ; } else if ( digestExists ( "MD5" ) ) { return getDigest ( "MD5" ) ; } return null ; }
Returns the strongest message digest algorithm supported by the server and client .