I am hashing string using SHA-256. I want to find out if the any byte matches certain value. I am using
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(message.getBytes(StandardCharsets.UTF_8));
for(byte c : hash) {
if( String.format("%02X ",c) == "69" || String.format("%02X ",c) == "CB" ) {
...
}
System.out.println(String.format("%02X ",c));
}
Here i want to check if any of bytes equals 69 or CB in hexa. However this condition is never set to true even if those bytes actually represet those values. Is ther any special way how to compare bytes with certain value?
thanks for help.