Fact-checked by Grok 2 weeks ago

Argon2

Argon2 is a family of memory-hard key derivation functions designed primarily for secure password hashing, proof-of-work applications, and key derivation, emphasizing resistance to GPU, ASIC, and side-channel attacks through high memory requirements and efficient use of multiple computing cores. It was developed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich at the and selected as the final winner of the (PHC) in July 2015 from among 24 submissions. The PHC, launched in 2013, aimed to identify a modern standard for password hashing to replace older algorithms like and by prioritizing memory hardness to counter parallel hardware attacks. Argon2 operates on including a , , and tunable parameters for time cost (iterations), memory cost (in kibibytes), and parallelism (number of threads), producing a fixed-length output . It uses the BLAKE2b internally and is optimized for x86 architectures to achieve high -filling rates while minimizing time-space trade-offs, where attackers attempt to reduce memory usage at the expense of increased time. The design provides for up to 2256 and preimage resistance for 2512 , making it suitable for protecting low-entropy secrets like passwords without requiring additional secret keys. The family includes three main variants to address different security needs: Argon2d, which uses data-dependent memory access for maximum resistance to GPU attacks and is ideal for proof-of-work in cryptocurrencies; Argon2i, which employs data-independent access to mitigate side-channel vulnerabilities like timing attacks, though it is slower and preferred for password hashing; and Argon2id, a hybrid introduced in version 1.3 that combines the strengths of the first two for balanced protection in general use cases. is now recommended as the default variant due to its effectiveness against both and side-channel threats. The algorithm's specifications were formalized in an IETF informational 9106 in September 2021 by the Crypto Forum Research Group, providing an implementer-focused description and reference code.

Introduction

Purpose and Overview

Argon2 is a memory-hard (KDF) specifically designed for secure password hashing and proof-of-work applications. It aims to protect against brute-force attacks by demanding substantial computational resources, particularly , which increases the cost of parallelization on specialized hardware like GPUs and . Developed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich at the , Argon2 was released in 2015 and is dual-licensed under the CC0 public domain dedication and the Apache License 2.0, allowing broad adoption and implementation. As a state-of-the-art successor to earlier memory-hard functions like and , Argon2 improves upon their designs by offering higher memory efficiency and resistance to side-channel attacks while maintaining tunable parameters for performance. It emerged as the winner of the 2015 (PHC) and includes variants—Argon2d for data-dependent applications, Argon2i for resistance to certain side-channels, and Argon2id as a —to address diverse security requirements.

Key Features

Argon2 is designed with extensive configurability to allow implementers to balance , , and resource constraints. Key adjustable parameters include the number of iterations (t), which controls execution time and ranges from 1 to 2^{32}-1; memory usage (m) in kibibytes (KiB), set between 8p and 2^{32}-1 to ensure sufficient resource demands; degree of parallelism (p), specifying the number of lanes or threads from 1 to 2^{24}-1 for multi-core utilization; and output length (T), the tag size in bytes from 4 to 2^{32}-1. The function employs BLAKE2b as its underlying for both initialization and operations, leveraging this secure and efficient to process data blocks. Argon2 adopts a sponge-like construction, where inputs are absorbed into the internal state and outputs are squeezed from it, facilitating flexible handling of variable-length data while maintaining security properties. It supports a range of inputs to enhance versatility: a mandatory of 8 to 2^{32}-1 bytes for domain separation and to attacks; an optional secret key of up to 2^{32}-1 bytes for key derivation scenarios; and optional associated data up to 2^{32}-1 bytes for additional context binding. The core memory-hard design utilizes a fixed-size array of up to 2^{32}-1 KiB, intentionally allocating substantial to deter cost-effective attacks on specialized like GPUs or .

History and Development

Password Hashing Competition

The (PHC) was announced in the first quarter of 2013 by a panel of cryptographers led by Jean-Philippe Aumasson, with the aim of identifying a modern standard for password hashing to address vulnerabilities in existing schemes like and . The competition ran until 2015, receiving 24 submissions by the deadline of March 31, 2014, and shortlisting nine finalists in December 2014 based on criteria including and benchmarks. Its primary goals were to develop memory-hard functions that resist brute-force attacks accelerated by GPUs or , side-channel attacks, and time-memory (TMTO) attacks, while maintaining cryptographic properties such as preimage resistance. Argon2 was submitted by a team from the —Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich—and was announced as the winner on July 20, 2015, after extensive community review and . The selection highlighted Argon2's balance of strong security against parallel hardware attacks, efficient performance across diverse platforms, and relative simplicity in implementation compared to other candidates. For context, the panel also gave special recognition to finalists like Lyra2, noted for its multi-round structure, and yescrypt, praised for its hardware attack resistance, underscoring the competition's emphasis on diverse approaches to memory-hardness. The initial specification for Argon2 was released in December 2015 on the PHC website, detailing its parameters and variants to facilitate immediate adoption and further scrutiny.

Standardization and Adoption

Following its selection as the winner of the in 2015, Argon2 was initially released as version 1.0 that year by its designers, Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich. This version established the core memory-hard design for password hashing. In 2017, version 1.3 was issued to address early security issues, including mitigations against time-memory trade-off attacks in the Argon2i variant and refinements to side-channel resistance, enhancing overall robustness without altering the fundamental algorithm. A key milestone in formalization came in September 2021, when the (IETF) published 9106, an informational document specifying Argon2 as a memory-hard function suitable for password hashing and proof-of-work applications. The provides detailed recommendations on parameters and variants, such as preferring Argon2id for balanced security, but it does not represent an official IETF standard or endorsement. This publication has guided implementers in achieving and best practices. Adoption accelerated post-2015, with integrations into major libraries and frameworks. Libsodium incorporated Argon2 in version 1.0.9, released April 2, 2016, making it available via its high-level password hashing API, with explicit support for the Argon2id variant added in version 1.0.15, released December 13, 2017. PHP added native support for Argon2i in version 7.2, released November 30, 2017, through the password_hash() function, with Argon2id following in version 7.3. The Open Web Application Security Project (OWASP) has recommended Argon2, particularly the Argon2id variant, in its Password Storage Cheat Sheet since at least 2017 updates, positioning it as the preferred option over older algorithms like bcrypt. By 2025, analyses of open-source repositories indicate widespread use in web applications and databases, though configuration practices vary, with approximately 46.6% of deployments using parameters below OWASP guidelines. The reference implementation's release under the CC0 1.0 dedication, equivalent to , has enabled unrestricted adoption and modification across programming languages and platforms, contributing to its proliferation without licensing barriers. As of 2025, Argon2 serves as the for hashing in new systems, benefiting from ongoing security audits of implementations, such as those in libraries like libsodium, to address evolving threats like GPU acceleration and side-channel exploits.

Design Principles

Memory-Hardness Mechanism

Argon2 is a memory-hard , designed such that its optimal evaluation requires substantial () and sequential access patterns, thereby imposing a high computational cost on parallelized attacks using specialized like graphics processing units (GPUs) or application-specific integrated circuits (). This property is formally characterized by a time penalty D(\alpha) for using only \alpha M , where M is the full memory requirement, satisfying D(\alpha) > 1/\alpha as \alpha \to 0, ensuring that reducing memory usage leads to superlinear increases in computation time. The core of Argon2's memory-hardness lies in its block-based memory structure, where the allocated memory is organized as a B consisting of blocks, each 1024 bytes (1 KiB) in size. This matrix has p rows, corresponding to lanes that enable parallelism, and q = m'/p columns, where m' is the adjusted number of blocks derived from the user-specified parameter m in KiB to ensure compatibility with the parallelism degree p (specifically, m' = \lfloor m / (4p) \rfloor \cdot 4p). The first two blocks of each lane are initialized using a hash of the inputs, while subsequent blocks are filled through a process that depends on prior blocks across lanes and columns, enforcing widespread data dependencies throughout the memory array. The total is thus M = m \times 1024 bytes. To establish these dependencies and prevent efficient parallel evaluation or memory reuse, Argon2 employs a permutation-based mixing operation via the G-function, which is derived from the Blake2b cryptographic permutation. The G-function takes two 1024-byte blocks X and Y as inputs. It computes R = X ⊕ Y, views R as an 8×8 matrix of 16-byte registers, applies the Blake2b-based permutation P first row-wise and then column-wise to produce Z, and outputs the single 1024-byte block Z ⊕ R. This operation is used to compute each new block from the prior block in the same lane and a selected reference block, ensuring that each new block relies on pseudorandomly selected previous blocks from different lanes and positions, which disrupts locality and forces sequential traversal of the large memory space. In contrast to CPU-hard functions that primarily burden general-purpose processors through intensive operations, Argon2's design specifically targets limitations in and , which are particularly acute on GPUs and optimized for high-throughput computation but inefficient at handling large, non-local accesses. By requiring the loading and mixing of distant 1024-byte blocks repeatedly over multiple passes, Argon2 elevates the area-time product cost for implementations, making brute-force attacks economically infeasible even with massive parallelism.

Resistance to Attacks

Argon2's memory-hard design imposes significant time and memory requirements on computations, which directly contributes to its resistance against brute-force attacks, particularly offline dictionary and attacks on stolen databases. By mandating large memory allocations—such as 1 or more for practical levels—the function ensures that attackers face exponentially higher costs in terms of both computational time and hardware resources compared to lighter hashing algorithms. This approach raises the economic barrier for exhaustive searches, making brute-force cracking infeasible on within reasonable timeframes. To counter the advantages of hardware like GPUs and , Argon2 employs access patterns that are either data-dependent (in Argon2d) or data- (in Argon2i), limiting the efficiency gains from massive parallelism. The -hard nature requires each parallel unit to access substantial , reducing the throughput benefits of specialized that excels in compute-intensive but -light tasks. Additionally, the inclusion of costly operations like multiplications in the core compression function increases the depth for implementations, aiming to balance across CPU, GPU, and custom . Argon2 mitigates time-memory tradeoff (TMTO) attacks through its multi-pass architecture and inter-block dependencies, which prevent attackers from significantly reducing memory usage at the expense of increased computation time. In the Argon2i variant, multiple passes over the memory array ensure that shortcuts in memory access do not yield substantial tradeoffs, with the design limiting any potential reductions to minimal factors even under optimized attacks. This structure enforces a high time-area product, preserving the overall resource cost for adversaries attempting to trade space for time. For protection against side-channel attacks, such as timing or cache-based leaks, Argon2 incorporates constant-time operations throughout its processing and offers mode-specific mitigations. The Argon2i variant uses data-independent memory addressing to avoid patterns that could reveal information through access timings, making it suitable for environments where side-channel vulnerabilities are a concern, like password hashing in interactive applications. In contrast, the hybrid Argon2id mode combines data-dependent and independent phases to balance security and performance while still providing resistance in the initial passes. Argon2's tunable parameters— including memory size, iterations, and parallelism—make it well-suited for proof-of-work applications, such as mining, where adjustable difficulty levels can enforce equitable resource consumption across participants. The memory-hard requirements discourage the dominance of ASIC miners by favoring general-purpose , promoting a more decentralized ecosystem. For instance, configurations like 250 MB of with short times on standard CPUs allow for fair while the challenge based on network needs.

Algorithm

Initialization and Parameters

Argon2 requires two primary inputs: a P of arbitrary length up to $2^{32}-1 bytes and a S of length between 8 and $2^{32}-1 bytes, where the salt must be unique for each to prevent attacks. Optionally, it accepts a secret key K of up to $2^{32}-1 bytes for keyed hashing scenarios, such as when additional server-side protection is needed, and associated data X of up to $2^{32}-1 bytes to bind the hash to contextual information for integrity verification. The algorithm is configured via several core parameters that control its computational cost and output: the degree of parallelism p, an integer from 1 to $2^{24}-1 specifying the number of parallel lanes; the memory allocation m in kibibytes (KiB), ranging from $8p to $2^{32}-1 to ensure at least 8 KiB per lane; the number of iterations t, from 1 to $2^{32}-1, dictating the number of passes over the memory; the desired output length in bytes, between 4 and $2^{32}-1; the variant type y, where 0 denotes Argon2d, 1 denotes Argon2i, and 2 denotes Argon2id; and the version number v = 0x13 (decimal 19), indicating the specification revision. Initialization begins by computing a 64-byte value H_0 using the BLAKE2b applied to a concatenated input block consisting of the little-endian 32-bit encodings of p, the output length, m, t, v, and y, followed by the length-prefixed representations of P, S, K, and X. This H_0 seeds the memory array B, which is structured as an array of 1024-byte blocks totaling m blocks nominally (since m is specified in KiB and each block is 1 KiB). To ensure alignment with the processing requirements across p lanes, the effective number of blocks is set to m' = 4 \times p \times \left\lfloor \frac{m}{4p} \right\rfloor. For each lane i from 0 to p-1, the initial blocks B{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}} and B{{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}} are derived by applying BLAKE2b (configured for 1024-byte output) to H_0 concatenated with the little-endian 32-bit values of j (0 or 1) and i.

Core Processing Steps

The core processing of Argon2 occurs in three main phases, which manipulate a organized into p parallel lanes, each consisting of q sequential 1024-byte blocks, for a total of up to m bytes of . These phases are common across all variants, differing only in how reference blocks are selected during computation. The process relies on a compression function G to mix data, ensuring memory-hardness by requiring to pseudorandomly addressed blocks. Phase 1: Filling Memory Blocks. This initial populates the entire starting from a derived from input parameters. For each i (0 ≤ i < p), the first two blocks B[i] and B[i] are initialized using a 1024-byte hash H' of the 64-byte H_0 concatenated with little-endian encodings of the block index j (0 or 1) and lane index i. The remaining blocks in each lane are then filled column-wise: for j from 2 to q-1, compute *B[i][j] = G(*B[i][j-1], B[l][z]) , where (l, z) is a reference block address determined by the variant-specific indexing function applied to B[i][j-1] and j. This sequential intra-lane dependency in the filling pass ensures that each block depends on the immediately preceding one in the same lane, while the inter-lane reference promotes diffusion across the memory. The filling is performed slice-wise—dividing the q columns into SL = 4 slices of size s ≈ q/4 blocks each (specifically, columns 2 to q-1 divided into 4 slices)—to enable lane-parallel execution without altering dependencies. The following pseudocode illustrates the structure of Phase 1 (adapted for clarity, with variant-specific indexing in the Index function):
for i = 0 to p-1:
    B[i][0] ← H'(H_0 || LE32(0) || LE32(i))
    B[i][1] ← H'(H_0 || LE32(1) || LE32(i))
for slice = 0 to SL-1:  // SL = 4 slices for parallelism
    for i = 0 to p-1:
        for pos = 0 to s-1:  // s blocks per slice
            j ← slice * s + pos  // Column index
            if j < 2: continue
            (l, z) ← Index(B[i][j-1], j, variant parameters)
            B[i][j] ← G(B[i][j-1], B[l][z])
This phase requires accessing nearly all memory blocks once, setting up the data-dependent structure for subsequent passes. Phase 2: Main Computation. If the number of passes t exceeds 1, this phase performs t-1 additional iterations over the memory to further mix the data and increase computational cost. Each pass processes the memory slice-wise, similar to Phase 1, but updates blocks in place by XORing the new computation with the existing value: for each j ≥ 1 in a slice, *B[i][j] ← G(*B[i][j-1], B[l][z]) ⊕ B[i][j] , where (l, z) is again a variant-dependent reference address. For the first block in each lane (j=0), the reference is typically from the end of the previous pass to close the loop. The slice-wise processing maintains intra-lane sequential dependencies (each block depends on the prior one in the lane) while allowing parallel computation across lanes, with inter-lane references providing randomization. This multi-pass structure amplifies resistance to time-memory trade-offs by forcing repeated full-memory traversals. G-Function Details. The core mixing operation G takes two 1024-byte input blocks X and Y and produces a 1024-byte output block. It begins by computing R = X ⊕ Y, treating R as an 8×8 matrix of 128-byte subblocks (rows and columns). A permutation function P—based on BLAKE2b's quarter-round operations and consisting of 2 rounds of mixing—is applied row-wise to each of the 8 rows: for row index r, the 128 bytes (equivalent to 8 consecutive 16-byte words) are mixed using the GB function on its working registers, followed by a rotation to mix within the row. The same P is then applied column-wise to the resulting 8 columns, again treating each as 128 bytes across the rows. The output is Z ⊕ R, where Z is the doubly-permuted matrix. This design leverages BLAKE2b's proven security for diffusion while operating on fixed-size subblocks to avoid side-channel leaks from variable addressing. The G-function ensures that each block update propagates changes across 1024 bytes, contributing to the overall avalanche effect in the memory array. Phase 3: Finalization. After all passes, a final 1024-byte block C is computed by XORing the last block from each lane: C = ⊕_{i=0}^{p-1} B[i][q-1] . This aggregates information from all lanes into a compact representation. The output tag of length T bytes is then derived by applying the T-byte hash function H' to C. This step ensures the final result depends on the entire memory state without requiring additional computation.

Output Generation

After the core processing steps, the finalization phase extracts a representative state from the memory array to produce the hash output. The final block C is computed as the bitwise XOR of the last block from each of the p lanes:
C = B{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}}[q-1] \oplus B{{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}}[q-1] \oplus \cdots \oplus B[p-1][q-1],
where q = m'/p is the number of blocks per lane and each block is 1024 bytes, yielding a 1024-byte C. This aggregation ensures the output depends on the entire memory state while maintaining a fixed intermediate size for hashing.
The output tag is then generated by applying the variable-length hash function H' to C, controlled by the desired output length T (ranging from 4 to $2^{32}-1 bytes):
\text{Tag} = H'^{T}(C).
The function H' is built atop BLAKE2b, which supports arbitrary output sizes through its extensible design: for T \leq 64, it computes BLAKE2b on the of the little-endian 32-bit encoding of T and C, truncated to T bytes; for T > 64, it uses an iterative construction where r = \lceil T/32 \rceil - 2, computes intermediate 64-byte values V_i starting from V_1 = BLAKE2b^{64}(LE32( T ) || C ), then V_i = BLAKE2b^{64}(V_{i-1}) for i=2 to r, and V_{r+1} = BLAKE2b^{T - 32r}(V_r) ; the output is the of the first 32 bytes of each V_1 to V_r followed by V_{r+1}. This mechanism avoids security degradation for varying lengths, as BLAKE2b's internal structure permits secure extension and truncation.
The resulting binary tag is typically encoded in a human-readable format for storage and verification, following the (PHC) convention. This includes the variant (e.g., argon2id), version (e.g., v=19), parameters (e.g., m=65536 for in KiB, t=3 for iterations, p=1 for parallelism), a base64url-encoded , and the base64url-encoded tag, delimited by dollar signs: $argon2id$v=19$m=65536,t=3,p=1$<base64salt>$<base64tag>. The base64url encoding uses the alphabet A-Z, a-z, 0-9, -, and _ (without padding), ensuring compatibility and compactness.

Variants

Argon2d

Argon2d is the data-dependent variant of the Argon2 password-hashing function, designed to prioritize resistance against time-memory tradeoff attacks in offline scenarios. In this mode, memory access patterns are input-specific, as block indices for reading previous blocks depend directly on the values derived from the password and other inputs. This dependency makes Argon2d particularly suitable for applications like proof-of-work systems in cryptocurrencies, where side-channel threats are minimal and the focus is on computational hardness without real-time access to the system. The in Argon2d employs a permutation function \phi(j) that selects the reference for the j-th based on the content of the immediately preceding . Specifically, the is calculated as \phi(j) = \text{Truncate}(M_{j-1}) \mod j, where M_{j-1} is the previous and Truncate extracts a 32-bit integer from it. Unlike data-independent variants, this approach allows the —derived from the , , and other parameters—to influence all subsequent memory accesses directly, creating a chain of dependencies that propagates through the computation. During initialization, the first M_1 is set to the of the input parameters using BLAKE2b, ensuring that variations in the input immediately affect the addressing sequence. This data-dependency enables performance optimizations, such as preventing CPU prefetching of memory blocks, which results in Argon2d being approximately 50% faster than comparable functions like scrypt in multi-threaded environments. For instance, on a 2 GHz processor with 8 threads, it achieves around 0.61 cycles per byte for certain parameter sets. However, the input-specific access patterns increase vulnerability to timing attacks, making Argon2d less ideal for online password verification where adversaries might exploit execution time variations. Recommended parameters for proof-of-work applications include 2 lanes, 250 MB of memory, and timings around 0.1 seconds on a single 2 GHz core to balance security and usability.

Argon2i

Argon2i is the data-independent variant of the Argon2 memory-hard function, specifically engineered to mitigate side-channel attacks in environments where memory access patterns could leak sensitive information, such as through timing or . Unlike data-dependent variants, Argon2i employs fixed, password-independent patterns for referencing blocks, ensuring that the sequence of accesses remains uniform and unpredictable based on input data. This design promotes resistance to attacks that exploit variations in execution time or resource usage to infer password details. The core of Argon2i's addressing mode relies on block indices derived from predetermined, non-input-dependent mechanisms, such as a counter-based pseudo-random G2 to produce indices J1 and J2, based on fixed parameters like pass number, lane, and slice indices. Such patterns are generated using a pseudo-random number seeded by fixed parameters like pass number, lane, and slice indices, further randomizing references without input influence. Argon2i finds primary application in scenarios involving online verification, where servers must compute hashes in and are vulnerable to remote timing attacks that could probe states over the network. By maintaining consistent access regardless of the , it reduces the feasibility of these attacks, making it suitable for frontend systems or key derivation in resource-constrained settings. A key in Argon2i is its performance penalty compared to the data-dependent Argon2d variant: the uniform access requires additional computational overhead, resulting in slower execution—approximately 2 cycles per byte on x86 processors (e.g., with 8 threads) versus 0.6 for Argon2d—due to the need for more passes to compensate for reduced parallelism opportunities. However, this comes at the benefit of enhanced against cache-timing exploits, which could otherwise allow attackers to reconstruct contents with significantly less effort. To counter vulnerabilities like time- (TMTO) attacks in multi-target scenarios, version 1.3 of Argon2i incorporated fixes that necessitate more than 10 passes over the for adequate , elevating the computational barrier for adversaries while preserving side-channel .

Argon2id

Argon2id is a variant of the Argon2 password-hashing function that combines elements of Argon2i and Argon2d to provide a balanced approach to security and performance. It operates in data-independent mode, similar to Argon2i, for the first half of the first pass over the memory blocks, and then switches to data-dependent mode, akin to Argon2d, for the remainder of the computation. This design ensures that the initial memory access pattern remains unpredictable to mitigate side-channel attacks, while the later data-dependent addressing enhances resistance to GPU-based parallelization and time-memory trade-off attacks. The variant is specified with a type parameter value of 2, distinguishing it from Argon2d (type 0) and Argon2i (type 1). It requires a minimum of one iteration (t=1) to exhibit its hybrid behavior, though additional passes can be configured for increased computational cost. Argon2id was introduced in version 1.3 of the Argon2 specification to address vulnerabilities identified in earlier iterations of Argon2i, such as time-memory trade-off exploits that allowed reduced memory usage during attacks. RFC 9106 recommends Argon2id as the preferred option for general-purpose password hashing, positioning it as the first choice over the pure variants due to its ability to mitigate the individual weaknesses of Argon2i (vulnerability to side-channel and attacks) and Argon2d ( to side-channel timing). By retaining early to side-channel attacks through data-independent access and incorporating later data-dependency for robust GPU , Argon2id achieves a comprehensive profile suitable for most applications without requiring specialized tuning.

Security Analysis

Cryptanalysis Results

Argon2d has demonstrated strong resistance to practical cryptanalytic attacks, primarily due to its data-dependent memory access pattern, which complicates time-memory tradeoff (TMTO) attacks by making precomputation password-specific. The best known TMTO on Argon2d achieves only a modest reduction factor of approximately 1.33 in the time-area product, far from enabling efficient parallelization on GPUs or ASICs. For Argon2i, a significant was identified in version 1.2 by Biryukov, Dinu, and Khovratovich in , exploiting the fixed addressing scheme in the low-storage attack to compute the with roughly 5 times less for single- and two-pass configurations without increasing time. This attack relied on precomputing access patterns independently of the password and , allowing space savings of up to n/5 empirically; it was mitigated in version 1.3 by modifying the overwrite mechanism to XOR new blocks with the previous contents, disrupting the fixed-address exploitation. Subsequent by Alwen and Blocki extended TMTO attacks on the updated Argon2i, achieving a reduction factor of about 3 for three passes at 1 GiB , with the factor decreasing as passes or increase; asymptotically, the best attacks require O(m^{0.233}) time-space resources, approaching the optimal O(m^{0.25}) bound. The hybrid Argon2id variant inherits the mitigations from both Argon2d and Argon2i, with no dedicated breaks reported beyond generic TMTOs; it experiences a reduction factor of about 2.1 for one pass (combining low-storage and ranking attacks) but drops to 1.33 for multiple passes, making it recommended for use with sufficient iterations (e.g., one with adequate ) to minimize vulnerabilities. In general, Argon2's derives directly from that of the underlying BLAKE2b , which requires at least 2^{256} operations for practical collisions under standard assumptions. Memory-hardness proofs establish that TMTO attacks on Argon2 incur a cost scaling with the of the memory size M, formalized approximately as attack time \sim t \sqrt{m/p}, where t is the number of iterations, m the memory in blocks, and p the passes, ensuring that reducing memory quadratically increases time.

Side-Channel Resistance

Argon2's design incorporates measures to mitigate side-channel attacks, such as timing and leaks, which exploit details rather than algorithmic weaknesses. All variants require constant-time implementations to prevent timing leaks, where execution time varies based on input data; the adheres to this by avoiding data-dependent branches and using uniform memory access patterns where possible. The variants differ in their inherent resistance to side-channel attacks due to memory access patterns. Argon2i employs data-independent addressing, accessing memory in a password-independent order to resist cache-timing and other side-channel attacks, making it suitable for environments where such threats are prominent. Argon2id, a hybrid, provides similar protection by operating in data-independent mode for the first half of the first pass, transitioning to data-dependent mode thereafter, thus balancing side-channel resistance with other security goals. In contrast, Argon2d relies on data-dependent memory access for its core operations, which enhances resistance to GPU-based cracking but introduces vulnerabilities to side-channel attacks if not carefully implemented. Early analyses identified specific issues with Argon2d, including susceptibility to cache-timing attacks stemming from its data-dependent indexing function, which can leak information through cache state variations. Mitigations for these vulnerabilities include selecting Argon2i or Argon2id over Argon2d in threat models involving side-channels, enabling memory-wiping options to clear sensitive data post-computation, and employing constant-time memory access techniques in custom implementations to avoid predictable patterns. Best practices also recommend using oblivious constructions or randomized memory layouts where feasible, though these add computational overhead; the emphasizes Argon2id with one iteration and sufficient memory (e.g., 2 GiB) as a uniformly safe configuration against side-channel threats. Custom implementations remain risky, as deviations from constant-time practices can reintroduce vulnerabilities, underscoring the need for rigorous code reviews and adherence to reference designs.

Guidelines from RFC 9106

RFC 9106, published in September 2021 by A. Biryukov, D. Dinu, D. Khovratovich, and S. Josefsson, standardizes as a memory-hard function for password hashing and proof-of-work applications, providing specific parameter guidelines to ensure interoperability and security compliance. These guidelines emphasize the use of (type=2) as the mandatory variant for new implementations due to its resistance to side-channel attacks, while and are optional. All compliant implementations must support version v=0x13 (19 in decimal). The RFC outlines three parameter profiles tailored to different security and resource needs, with memory cost (m) expressed in KiB, time cost (t) in passes, and parallelism (p) in lanes. The default profile, recommended for general-purpose password hashing on typical backend servers, uses m=2^{21} KiB (2 GiB), t=1, and p=4, producing a 256-bit (32-byte) output and targeting approximately 0.5 seconds of computation on a 2 GHz CPU with 4 cores. For high-security scenarios requiring maximized adversarial costs, the memory-hard profile retains m=2^{21} KiB (2 GiB), t=1, and p=4, also with a 256-bit output, to prioritize memory usage while maintaining side-channel protections. In contrast, the low-memory profile for constrained devices sets m=2^{16} KiB (64 MiB), t=3, and p=4, again yielding 256 bits of output to balance security with limited resources. Salt lengths should be at least 64 bits (8 bytes) but are recommended at 128 bits (16 bytes) to prevent attacks exploiting fixed salts, while output lengths of 128 bits are sufficient for most uses but 256 bits are preferred for stronger derived keys. These parameters assume the standard definitions of m, t, and p as outlined in the initialization process.
ProfileTypem (KiB)tpOutput (bits)Target Runtime (2 GHz, 4-core CPU)Use Case
DefaultArgon2id2^{21} (2 GiB)14256~0.5 secondsGeneral backend servers
Memory-HardArgon2id2^{21} (2 GiB)14256~0.5 secondsHigh-security hashing
Low-MemoryArgon2id2^{16} (64 MiB)34256Adjusted for constraintsResource-limited devices

Practical Tuning

In practical applications, tuning Argon2 parameters involves balancing security enhancements against computational costs to ensure robust protection without unduly impacting user experience. The memory cost parameter (m) should be increased to heighten resistance to parallel attacks on GPUs and ASICs, as higher memory requirements limit the efficiency of such hardware in brute-force attempts. The time cost (t) can be adjusted to elevate CPU-intensive operations, thereby slowing sequential cracking efforts, while the parallelism factor (p) allows utilization of multi-core processors to distribute the workload without proportionally increasing verification time. As a starting point for tuning, the defaults outlined in RFC 9106 offer a baseline that can be scaled according to deployment constraints. The goal is typically to achieve a verification time of 0.1 to 1 second, ensuring delays are perceptible to attackers but negligible for legitimate users during login processes. Hardware capabilities significantly influence parameter selection to maintain across diverse environments. On servers with ample resources, costs up to 1 GiB are feasible, allowing for stronger security postures by allocating substantial per computation, which can take around 0.5 seconds on modern multi-core CPUs. In contrast, mobile devices with limited and constraints warrant lower settings, such as m=19 paired with t=2, to keep hashing under 250 ms while still providing adequate protection against offline attacks. Effective monitoring ensures parameters remain suitable as hardware evolves. Developers should conduct benchmarks on target systems to measure hashing durations, aiming for approximately 250 ms per login to balance usability and defense against real-time attacks, and periodically readjust t or m to account for processor speed improvements that could otherwise erode security margins. Common pitfalls in tuning can undermine Argon2's effectiveness, such as setting m below 64 MiB, which enables efficient GPU-based cracking and negates the algorithm's memory-hard advantages. Additionally, failing to use unique, randomly generated salts for each password—typically 16 bytes or more—exposes systems to attacks, even with proper parameter choices. In 2025, with advancing threats, practitioners are advised to prioritize higher memory costs in Argon2 configurations to amplify the quadratic slowdown imposed by on search operations, thereby extending the practical security lifespan of hashed credentials against quantum-accelerated brute-force efforts.

Implementations and Applications

Software Libraries

The of Argon2 is a C-based library developed as part of the (PHC) winners, hosted on under the P-H-C organization. This implementation provides the core functionality for all three variants (Argon2d, Argon2i, and Argon2id) and has been integrated into various projects, though the repository is marked as unmaintained since the algorithm and API were finalized. Several language bindings and wrappers extend the reference implementation for ease of use in different programming ecosystems. In , the argon2-cffi library offers high-level bindings via CFFI to the official Argon2 implementation, supporting secure password hashing with automatic parameter handling. For Go, the standard library's golang.org/x/crypto/argon2 package implements Argon2 as a , compatible with the PHC specifications. Java developers can utilize the Argon2PasswordEncoder from , which leverages Bouncy Castle for native Argon2 support including configurable and output lengths. In , Argon2id is natively supported through the password_hash function with the PASSWORD_ARGON2ID constant, available since PHP 7.3 when compiled with Argon2 support. Major cryptographic libraries have incorporated Argon2 for broader adoption. Libsodium, a popular portable suite, includes support for Argon2i and Argon2id variants in its password hashing , enabling explicit selection of the algorithm since version 1.0.15. OpenSSL integrated Argon2 as a (EVP_KDF-ARGON2) starting with version 3.2, providing standardized access via its EVP interface for applications requiring memory-hard hashing. For , the node-argon2 package delivers bindings to the C , facilitating asynchronous password hashing in server-side environments. In , the rust-argon2 crate provides bindings to the , supporting all variants for secure applications. Argon2 implementations are available for hardware-accelerated or secure enclave environments. Multi-architecture libraries like the one from WOnder93 support processors, allowing deployment in ARM-based systems including those with TrustZone for isolated execution. Similarly, Argon2 can be integrated into SGX enclaves for protected key derivation, as demonstrated in secure computing frameworks that leverage SGX for credential handling. Implementations undergo regular security audits to ensure compliance with best practices. For instance, JavaScript-based Argon2 variants in noble-hashes have been audited for correctness and resistance to common vulnerabilities, excluding certain add-ons like blake3.

Use Cases

Argon2 is widely adopted for secure password storage in web applications, where it serves as a robust for user . In frameworks like , developers can configure Argon2 as the primary hashing driver to protect credentials against brute-force attacks by leveraging its memory-hard properties. Similarly, Django supports Argon2 through libraries such as argon2-cffi, enabling it for password hashing in production environments to ensure resistance to GPU-accelerated cracking. Beyond passwords, Argon2 functions as a (KDF) in web applications, transforming user inputs like passphrases into cryptographic keys for securing authentication or generating session tokens. This application benefits from Argon2's tunable parameters, which balance computational cost with security to mitigate denial-of-service risks during key generation on servers. The Argon2d variant is particularly suited for proof-of-work (PoW) scenarios, where its data-dependent resists specialized hardware exploitation. It has been proposed for use in cryptocurrencies as an alternative PoW mechanism to promote fair mining distribution, and in systems to impose computational burdens on automated bots without relying on visual puzzles. Argon2 aligns with regulatory standards for secure credential handling, satisfying the password storage requirements in NIST SP 800-63B for authenticator verifiers at various assurance levels by providing memory-hard hashing, as recommended in NIST SP 800-63B. Its implementation also supports GDPR compliance in data protection systems, as the algorithm's resistance to offline attacks helps safeguard against breaches. In contemporary deployments as of 2025, Argon2 features prominently in mobile applications, such as password managers on that employ it for master password derivation to secure vaults, often integrated via libraries for efficient on-device computation. Cloud-based services leverage Argon2 through supporting libraries for custom flows, enhancing in scalable user pools.

References

  1. [1]
    RFC 9106: Argon2 Memory-Hard Function for Password Hashing ...
    This document describes the Argon2 memory-hard function for password hashing and proof-of-work applications. We provide an implementer-oriented description ...Table of Contents · Introduction · Argon2 Algorithm · Security Considerations
  2. [2]
  3. [3]
    [PDF] Argon2: the memory-hard function for password hashing and other ...
    Dec 26, 2015 · Argon2 uses internal compression function G with two 1024-byte inputs and a 1024-byte output, and internal hash function H. Here H is the Blake ...
  4. [4]
    The password hash Argon2, winner of PHC - GitHub
    Argon2 is a password-hashing function that summarizes the state of the art in the design of memory-hard functions and can be used to hash passwords.
  5. [5]
    RFC 9106 - Argon2 Memory-Hard Function for Password Hashing ...
    Dec 8, 2023 · Argon2 is a memory-hard function [HARD]. It is a streamlined design. It aims at the highest memory-filling rate and effective use of multiple computing units.<|control11|><|separator|>
  6. [6]
    Fast and Tradeoff-Resilient Memory-Hard Functions for ...
    May 6, 2015 · Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich. Abstract. Memory-hard functions are becoming an important tool in the design of password ...
  7. [7]
  8. [8]
    Password Hashing Competition
    - **Argon2 as PHC Winner**: Confirmed as the winner of the Password Hashing Competition (PHC).
  9. [9]
    [PDF] Open Sesame - Cryptology ePrint Archive
    The Password Hashing Competition (PHC) [1] was an open competition run between. 2013 and 2015 by a group of cryptographers that aimed to select one or more ...
  10. [10]
    phc-winner-argon2/argon2-specs.pdf at master · P-H-C/phc-winner-argon2
    - **Insufficient relevant content**: The provided content is a GitHub page snippet lacking the full Argon2 specification document (argon2-specs.pdf). It does not contain authorship or copyright information for Argon2.
  11. [11]
    Password Storage - OWASP Cheat Sheet Series
    Out of the three Argon2 versions, use the Argon2id variant since it provides a balanced approach to resisting both side-channel and GPU-based attacks. Rather ...Missing: libsodium | Show results with:libsodium
  12. [12]
    Libsodium v1.0.12 and v1.0.13 Security Assessment
    Jan 26, 2024 · Our review of libsodium began with the v1.0.12 release from March 13th, 2017 and continued with commits since then to the release of v1.0.13 in ...
  13. [13]
    None
    ### Summary of Argon2 Design Features
  14. [14]
    [PDF] Fast and Tradeoff-Resilient Memory-Hard Functions for ...
    Argon2d is optimized for settings where the adversary does not get regular access to system memory or CPU,. i.e. he can not run side-channel attacks based on ...
  15. [15]
    [PDF] Towards Practical Attacks on Argon2i and Balloon Hashing
    In this work we answer all three of these questions to the affirmative for all three algorithms. It is also the first work to analyze the security of Argon2i-B.
  16. [16]
    Is Argon2id safe from the discovered Argon2i issues?
    May 1, 2020 · Argon2id is likely safe from Argon2i attacks, as the second part is more memory-hard. The RFC recommends Argon2id as the primary variant.When to use Argon2i vs Argon2d vs Argon2id?Argon2i versus Argon2d? - Cryptography Stack ExchangeMore results from crypto.stackexchange.com
  17. [17]
    None
    Summary of each segment:
  18. [18]
    [PDF] Efficiently Computing Data-Independent Memory-Hard Functions
    Mar 7, 2016 · The authors recommend using Argon2i for password hashing due to its resistance to side channel attacks [BDK15]. Our attacks only apply to ...
  19. [19]
  20. [20]
    Choosing Parameters - argon2-cffi 25.1.0 documentation
    Choose whether you want Argon2i, Argon2d, or Argon2id ( type ). If you don't know what that means, choose Argon2id ( argon2.low_level.Type.ID ). Figure out ...
  21. [21]
    Secure Password Storage: Best Practices & Hashing - Deepak Gupta
    Learn how to securely store user passwords with modern hashing algorithms like bcrypt, scrypt, and Argon2 ... Target hashing time: 250ms for authentication; Scale ...
  22. [22]
    password hashing - Argon2 - memory setting - lower bound?
    Sep 4, 2018 · An RFC for Argon2 has been published now, which provides several recommendations. Unfortunately, the situation is still not clear cut and ...<|separator|>
  23. [23]
    Argon2 in Practice: How to Implement Secure Password Hashing in ...
    May 6, 2025 · This article will act as an implementation guide for Argon2 the memory-hard password hashing algorithm in real world application.
  24. [24]
    [PDF] Optimized Quantum Circuit for Quantum Security Strength Analysis ...
    Argon2d: Argon2d uses fast, data-dependent memory accesses, making it highly resistant to GPU cracking attacks and suitable for applications where side-channel ...Missing: mitigations | Show results with:mitigations
  25. [25]
    phc-winner-argon2 is unmaintained · Issue #378 - GitHub
    Aug 12, 2024 · The repository hasn't been maintained, as the algorithm design and API have been frozen, the argon2 code was successfully integrated in various projects and ...
  26. [26]
    argon2 package - golang.org/x/crypto/argon2 - Go Packages
    Package argon2 implements the key derivation function Argon2. Argon2 was selected as the winner of the Password Hashing Competition and can be used to derive ...Documentation · Overview · Functions
  27. [27]
    Argon2PasswordEncoder (spring-security-docs 6.5.6 API)
    Constructs an Argon2 password encoder with a salt length of 16 bytes, a hash length of 32 bytes, parallelism of 1, memory cost of 1 << 12 and 3 iterations.
  28. [28]
    password_hash - Manual - PHP
    PASSWORD_ARGON2ID - Use the Argon2id hashing algorithm to create the hash. This algorithm is only available if PHP has been compiled with Argon2 support.Predefined Constants · Password_verify · Crypt · SensitiveParameter
  29. [29]
    Password hashing - Libsodium documentation - GitBook
    Sep 12, 2023 · Sodium's high-level crypto_pwhash_* API currently leverages the Argon2id function on all platforms. This can change at any point in time, but it ...Missing: date | Show results with:date
  30. [30]
    EVP_KDF-ARGON2 - OpenSSL Documentation
    The EVP_KDF-ARGON2 algorithm implements the Argon2 password-based key derivation function, as described in IETF RFC 9106.
  31. [31]
    Node.js bindings for Argon2 hashing algorithm - GitHub
    node-argon2 provides prebuilt binaries from v0.26.0 onwards. They are built every release using GitHub Actions. · node-argon2 works only and is tested against ...
  32. [32]
    WOnder93/argon2: A multi-arch library implementing the ... - GitHub
    The goal of this project is to provide efficient Argon2 implementations for various HW architectures (x86, SSE, ARM, PowerPC, ...). ... For QMake builds you can ...
  33. [33]
    Using Intel SGX to Protect Authentication Credentials in an ...
    An important principle in computational security is to reduce the attack surface, by maintaining the Trusted Computing Base (TCB) small.
  34. [34]
    paulmillr/noble-hashes: Audited & minimal JS ... - GitHub
    Changes since audit. Scope: everything, besides blake3 , sha3-addons , sha1 and argon2 , which have not been audited; The audit has been funded by Ethereum ...
  35. [35]
    Cryptographic Module Validation Program | CSRC
    The goal of the CMVP is to promote the use of validated cryptographic modules and provide Federal agencies with a security metric to use in procuring equipment.Validated Modules · Modules In Process · Search · FIPS 140-2Missing: Argon2 | Show results with:Argon2
  36. [36]
    Hashing - Laravel 12.x - The PHP Framework For Web Artisans
    By default, Laravel uses the bcrypt hashing driver when hashing data. However, several other hashing drivers are supported, including argon and argon2id. You ...
  37. [37]
    Password management in Django
    This document describes how Django stores passwords, how the storage hashing can be configured, and some utilities to work with hashed passwords.
  38. [38]
    How is Argon2 used for key derivation? [duplicate]
    Nov 5, 2021 · A key derivation is when you take some data, say a password, and use a function to convert it into a number that can be used as a secret key.key derivation - (How) can Argon2 be used to create both a hash for ...Argon2 for both password storage and key derivationMore results from crypto.stackexchange.comMissing: session | Show results with:session
  39. [39]
    The memory-hard Argon2 password hash and proof-of-work function
    ... lanes, the memory is organized in a matrix B[i][j] of blocks with p rows (lanes) and q = m' / p columns. 3. Compute B[i][0] for all i ranging from (and ...Missing: structure | Show results with:structure
  40. [40]
  41. [41]
    GDPR Password Management Compliance for Enterprises
    Encryption & Hashing: Passwords must never be stored in plain text. Secure hashing algorithms (e.g., bcrypt, Argon2) should be used.<|control11|><|separator|>
  42. [42]
    Hashing and Validation of Argon2 in Swift Implementation - MojoAuth
    Learn how to implement Argon2 encryption in Swift for secure password hashing. Explore examples, best practices, and enhance your app's security.Missing: iOS | Show results with:iOS
  43. [43]
    Raising the bar in security with Argon2. - Tuta
    Aug 23, 2023 · Argon2 is the most secure hashing functions to protect passwords and encryption keys.