private String encryptNow(String plaintext) { logger.debug("Encrypt:{}", plaintext); byte[] bytes = plaintext.getBytes(Charsets.UTF_8); for (int i = 0; i < hashTime - 1; i++) { Hasher hasher = chooseHasher(algorithm); bytes = hasher.putBytes(bytes).hash().asBytes(); } Hasher hasher = chooseHasher(algorithm); return hasher.putBytes(bytes).hash().toString(); }
@Override public String encrypt(final User user) { if (user == null) { throw new IllegalArgumentException("User can't be null"); } if (Strings.isNullOrEmpty(user.getPassword())) { throw new IllegalArgumentException("User's password can't be null or empty"); } return cache.getUnchecked(getPlainText(user)); }
@Override public String encrypt(final User user) { if (user == null) { throw new IllegalArgumentException("User can't be null"); } if (Strings.isNullOrEmpty(user.getPassword())) { throw new IllegalArgumentException("User's password can't be null or empty"); } return cache.getUnchecked(getPlainText(user)); }
private String encryptNow(String plaintext) { logger.debug("Encrypt:{}", plaintext); byte[] bytes = plaintext.getBytes(Charsets.UTF_8); for (int i = 0; i < hashTime - 1; i++) { Hasher hasher = chooseHasher(algorithm); bytes = hasher.putBytes(bytes).hash().asBytes(); } Hasher hasher = chooseHasher(algorithm); return hasher.putBytes(bytes).hash().toString(); }