JEP draft: Argon2 Password Hashing Algorithm

OwnerArtur Barashev
TypeFeature
ScopeSE
StatusDraft
Componentsecurity-libs / javax.crypto
EffortM
DurationM
Relates toJEP 510: Key Derivation Function API
Created2026/02/03 15:26
Updated2026/03/06 23:36
Issue8377081

Summary

Enhance the security of Java applications by providing an implementation of the Argon2 password hashing algorithm. Argon2 provides additional protection against brute-force password guessing attacks and was the winner of the 2015 Password Hashing Competition.

Goals

Motivation

The Java Platform should offer better support for password hashing algorithms beyond PBKDF2. PBKDF2 is compute-bound and low-memory, which maps well to massively parallel hardware and makes it susceptible to offline cracking with graphics processing units (GPUs) or application-specific integrated circuits (ASICs).

Argon2 is a memory-hard algorithm. Memory-hardness increases the cost of large-scale password guessing by limiting the degree to which attackers can exploit specialized hardware. For example, if each guess requires 64 MiB of memory, then a device with 8 GiB of available memory can execute only about 128 guesses in parallel, rather than thousands or millions.

The Java Platform should provide a standard memory-hard password hashing algorithm. OpenSSL, BouncyCastle and many other toolkits/libraries already support Argon2.

Description

Argon2 defines three variants:

This JEP proposes to implement Argon2id, thus offering a balance between side-channel resistance and TMTO protection. The algorithm will be implemented as a new KDF service of SunJCE provider, adhering to the architecture introduced in JEP 510.

Argon2id is parameterized by memory (m, in KiB), iterations (t) and parallelism (p). These parameters allow applications to tune computational and memory cost according to their deployment requirements.

Integration with the KDF API

Code Example

Argon2ParameterSpec param =
Argon2ParameterSpec.newBuilder()
    .parallelism(p).memoryKiB(m).iterations(t)
    .secret(secret).ad(associatedData)
    .nonce(nonce).tagLen(outputLen).build(password);
KDF k = KDF.getInstance("ARGON2ID");
// Generate password hash as a byte array.
byte[] value = k.deriveData(param);
// Generate output as a SecretKey.
SecretKey key = k.deriveKey("Generic", param);

Security Considerations

Side-Channel Considerations

Alternatives

Testing

Risks and Assumptions

Appendix

Migration from PBKDF2

PBKDF2 is implemented via javax.crypto.SecretKeyFactory while this JEP proposes to implement Argon2id via javax.crypto.KDF API. Java applications wishing to migrate from PBKDF2 to Argon2id will need to make code modifications to adopt KDF API.

While adopting Argon2id requires code changes, migrating stored credentials requires a data- and rollout-strategy as well, since PBKDF2 and Argon2id outputs are not interchangeable. Recommended strategies include:

RFC 9106 lists 2 uniformly safe options for Argon2id: