51NAV
Explained

bcrypt vs scrypt vs Argon2: How to Choose a Password Hash

Storing passwords means hashing with a slow, salted, memory-hard function. Here is how bcrypt, scrypt, and Argon2 differ and which to reach for in 2026.

2 min read Intermediate
#bcrypt #scrypt #argon2 #password #hashing
Table of Contents

Password hashing is not ordinary hashing

A password hash must do three things ordinary hashes do not: be salted (unique per password), slow (costly to brute-force), and ideally memory-hard (costly to parallelize on GPUs). That is why bcrypt, scrypt, and Argon2 exist.

Side by side

bcryptscryptArgon2id
Year199920092015 (PHC winner)
Tunable costrounds (cost)N (CPU), r (mem), p (parallel)m (memory), t (time), p (parallel)
Memory-hardNo (some)YesYes
SaltBuilt inBuilt inBuilt in
Outputcost$salt$hashNrp$salt$hashv=19$m=...,t=...,p=...$salt$hash

bcrypt

The veteran. Simple, battle-tested, salt built in. Its weakness is low memory use, so dedicated hardware can parallelize it. Keep the cost factor at 12+ today.

$2b$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdCE...

scrypt

Adds a memory cost (r) on top of CPU cost, raising the bar against GPU farms. Good choice when you cannot use Argon2.

params: N=2^14, r=8, p=1   (tune memory with r)

Argon2id

The modern default. id (data-independent + data-dependent) resists both side-channel and GPU attacks. Tune memory m, iterations t, and parallelism p.

m=19456, t=2, p=1   (≈19 MiB — a common starting point)

How to choose

  • New project: Argon2id, memory ≈ 19–64 MiB, tune t to keep a hash under ~500 ms.
  • Need broad legacy support: scrypt, or bcrypt with cost ≥ 12.
  • Anything: never use raw SHA-256/MD5, and always use a library that verifies in constant time.

Generate and verify

Hash passwords locally with the matching tools:

Next steps

Frequently asked questions

Plain SHA-256 is a hash, why not use it for passwords?

SHA-256 is fast and unsalted by default, so attackers brute-force or use rainbow tables cheaply. Password hashing needs salt and deliberate slowness, which SHA alone does not provide.

Which is the safest?

Argon2id is the current recommendation — it won the Password Hashing Competition and is memory-hard. scrypt is a strong fallback, and bcrypt is still acceptable if bumping the cost factor.

What is a salt?

A random value mixed into the hash so two users with the same password get different hashes, defeating precomputed rainbow tables.

Guide Info

Category
Explained
Difficulty
Intermediate
Reading Time
2 min
Tags
#bcrypt #scrypt #argon2 #password #hashing

Next guide

BIP39 Derivation Path m/44'/0'/0': What Each Segment Means

That slash-separated string decides which address your wallet shows. Here is what m, the apostrophes, purpose, coin type, account, change, and index each control.

View Next Guide