public static boolean isProperlyFormattedKey ( String hexadecimalStr ) { if ( hexadecimalStr == null ) return false ; // Length is expected to be the same as the digest ... final int length = hexadecimalStr . length ( ) ; if ( length != ALGORITHM . getHexadecimalStringLength ( ) ) return false ; // The characters all must be hexadecimal digits ... return StringUtil . isHexString ( hexadecimalStr ) ; }
Determine if the supplied hexadecimal string is potentially a binary key by checking the format of the string .