/** * Determine whether the supplied string is of the correct format to contain a hexadecimal representation of this * algorithm. * * @param string the string; may not be null * @return true if the string might contain a hexadecimal representation of this algorithm, or false otherwise */ public boolean isHexadecimal( String string ) { return string.length() == getHexadecimalStringLength() && StringUtil.isHexString(string); }
/** * Determine whether the supplied string is of the correct format to contain a hexadecimal representation of this * algorithm. * * @param string the string; may not be null * @return true if the string might contain a hexadecimal representation of this algorithm, or false otherwise */ public boolean isHexadecimal( String string ) { return string.length() == getHexadecimalStringLength() && StringUtil.isHexString(string); }
/** * Determine whether the supplied string is of the correct format to contain a hexadecimal representation of this * algorithm. * * @param string the string; may not be null * @return true if the string might contain a hexadecimal representation of this algorithm, or false otherwise */ public boolean isHexadecimal( String string ) { return string.length() == getHexadecimalStringLength() && StringUtil.isHexString(string); }
/** * Determine if the supplied hexadecimal string is potentially a binary key by checking the format of the string. * * @param hexadecimalStr the hexadecimal string; may be null * @return true if the supplied string is a properly formatted hexadecimal representation of a binary key, or false otherwise */ 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. * * @param hexadecimalStr the hexadecimal string; may be null * @return true if the supplied string is a properly formatted hexadecimal representation of a binary key, or false otherwise */ 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); }