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/02/27 20:45
Issue8377081

Summary

Implement the Argon2id password-hashing algorithm in the SunJCE provider via the javax.crypto.KDF API. This makes a modern password-hashing algorithm available through the standard Java cryptographic architecture.

Goals

Non-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 GPUs/ASICs.

Argon2, the winner of the 2015 Password Hashing Competition (PHC) and standardized in RFC 9106, 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 does not currently provide a standardized memory-hard password-hashing algorithm. Applications that require Argon2 rely on third-party libraries.

Description

Argon2 defines three variants:

This JEP proposes to implement Argon2id, thus offering a balance of side-channel attack and TMTO protection. Argon2id is parameterized by memory (m, in KiB), iterations (t), parallelism (p), output length, and version. These parameters allow applications to tune computational and memory cost according to their deployment requirements.

Integration with the KDF API

Example 1

// Specifying algorithm parameters manually and generating
// raw key material as a byte array.
Argon2ParameterSpec param =
Argon2ParameterSpec.newBuilder(argonVariant)
    .nonce(nonce).parallelism(p).memoryKiB(m)
    .iterations(t).tagLen(outputLen).build(password);
KDF k = KDF.getInstance("Argon2id");
byte[] value = k.deriveData(param);

Example 2

// Specifying algorithm parameters with PHC string and generating
// an output as a SecretKey.
Argon2ParameterSpec param =
Argon2ParameterSpec.newBuilder(phcString).build(password);
KDF k = KDF.getInstance("Argon2id");
SecretKey key = k.deriveKey("AES", param);

PHC String Format

The implementation supports parsing and encoding the PHC string format for all Argon2 variants.

Security Considerations

Side-Channel Considerations

Implementation Notes

Failure Behavior

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: