@Test void hidingSecretWithHash() { Obfuscate.secureSensitive = "HASH"; assertThat(Obfuscate.secureSensitive(TEST_STRING)).isEqualTo("hash:9eRM"); }
public static String secureSensitive(String value) { if (value == null) { return null; } if (isDisabled(secureLogs) && isDisabled(secureSensitive)) { return value; } if ("hash".equalsIgnoreCase(secureSensitive)) { return "hash:" + computeSha(value).substring(0, 4); } return "****"; }
Obfuscate { public static String secureSensitive(String value) { if (value == null) { return null; } if (isDisabled(secureLogs) && isDisabled(secureSensitive)) { return value; } if ("hash".equalsIgnoreCase(secureSensitive)) { return "hash:" + computeSha(value).substring(0, 4); } return "****"; } }
Obfuscate { public static String secureSensitive(String value) { if (value == null) { return null; } if (isDisabled(secureLogs) && isDisabled(secureSensitive)) { return value; } if ("hash".equalsIgnoreCase(secureSensitive)) { return "hash:" + computeSha(value).substring(0, 4); } return "****"; }  }
Obfuscate { public static String secureSensitive(String value) { if (value == null) { return null; } if (isDisabled(secureLogs) && isDisabled(secureSensitive)) { return value; } if ("hash".equalsIgnoreCase(secureSensitive)) { return "hash:" + computeSha(value).substring(0, 4); } return "****"; }  static String secure(String value, String delim); static String secure(String value); static String secureSensitiveChar(char[] value); static String secureSensitive(String value); }
Obfuscate { public static String secureSensitive(String value) { if (value == null) { return null; } if (isDisabled(secureLogs) && isDisabled(secureSensitive)) { return value; } if ("hash".equalsIgnoreCase(secureSensitive)) { return "hash:" + computeSha(value).substring(0, 4); } return "****"; }  static String secure(String value, String delim); static String secure(String value); static String secureSensitiveChar(char[] value); static String secureSensitive(String value);  }