@Test public void testMask() throws Exception { HashMask mask = new HashMask(); assertThat(mask.mask(null, null)).isNull(); assertThat(mask.mask("", null)).isEmpty(); String salt = HashMask.getSalt(); String encrypt = EncodeUtil.encodeHex(HashUtil.sha1("test" + salt)); assertThat(mask.mask("test", null)).isEqualTo(encrypt); }
@Override public String mask(String source, int[] params) { if (source == null || source.isEmpty()) { return source; } return EncodeUtil.encodeHex(HashUtil.sha1(source+getSalt())); }
HashMask implements MaskStrategy { @Override public String mask(String source, int[] params) { if (source == null || source.isEmpty()) { return source; } return EncodeUtil.encodeHex(HashUtil.sha1(source+getSalt())); } }
HashMask implements MaskStrategy { @Override public String mask(String source, int[] params) { if (source == null || source.isEmpty()) { return source; } return EncodeUtil.encodeHex(HashUtil.sha1(source+getSalt())); }  }
HashMask implements MaskStrategy { @Override public String mask(String source, int[] params) { if (source == null || source.isEmpty()) { return source; } return EncodeUtil.encodeHex(HashUtil.sha1(source+getSalt())); }  @Override String mask(String source, int[] params); static void setSalt(String salt); static String getSalt(); }
HashMask implements MaskStrategy { @Override public String mask(String source, int[] params) { if (source == null || source.isEmpty()) { return source; } return EncodeUtil.encodeHex(HashUtil.sha1(source+getSalt())); }  @Override String mask(String source, int[] params); static void setSalt(String salt); static String getSalt();  }