Code example for HashFunction

Methods: bits

0
 */ 
public class PasswordDigestService { 
  private static final Log log = LogFactory.getLog(PasswordDigestService.class);
 
  private static final HashFunction HASH_FUNCTION = Hashing.sha256();
  private static final int HASH_LENGTH = HASH_FUNCTION.bits() / Byte.SIZE;
  private static final int SECURE_SALT_LENGTH = HASH_LENGTH;
  private static final int LEGACY_SALT_LENGTH = 6;
 
  static { 
    assert SECURE_SALT_LENGTH != LEGACY_SALT_LENGTH;
  } 
 
  private static final Charset BYTE_ENCODING = Charsets.UTF_8;
  private static final BaseEncoding STRING_ENCODING = BaseEncoding.base16().lowerCase();
 
 
  private final Random random;
 
  public PasswordDigestService() { 
Experience pair programming with AI  Get Codota for Java