Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 65 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "argon2-cli"
version = "0.1.1"
version = "0.2.0"
edition = "2024"
authors = [
"Joel Schulz-Andres <joel@systemscape.de>",
Expand All @@ -21,11 +21,12 @@ eula = false

[dependencies]
argon2 = "0.5.3"
clap = { version = "4.5.54", features = ["derive"] }
clap = { version = "4.6.1", features = ["derive"] }
rand_core = { version = "0.6", features = ["getrandom"] }
hex = "0.4.3"

[dev-dependencies]
rand = { version = "0.9.2", features = ["std", "std_rng"] }
rand = { version = "0.9.4", features = ["std", "std_rng"] }

# The profile that 'dist' will build with
[profile.dist]
Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,30 @@ Generate Argon2 hashes from command line
## Installation

```bash
cargo install --path .
cargo install argon2-cli
```

Or via [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall):

```bash
cargo binstall argon2-cli
```

## Usage

```bash
echo -n "password" | argon2 somesalt
echo -n "password" | argon2
Comment thread
joelsa marked this conversation as resolved.
```

This CLI accepts the password via `stdin`, which avoids putting the password in shell history.

### Options

```
argon2 [-h] salt [-i|-d|-id] [-t iterations] [-m log2(memory in KiB) | -k memory in KiB] [-p parallelism] [-l hash length] [-e|-r] [-v (10|13)]
argon2 [-h] [salt] [-i|-d|-id] [-t iterations] [-m log2(memory in KiB) | -k memory in KiB] [-p parallelism] [-l hash length] [-e|-r] [-v (10|13)]
```

- `[salt]` Optional explicit salt; must be at least 8 characters long
- `-i` Use Argon2i (default)
- `-d` Use Argon2d
- `-id` Use Argon2id
Expand All @@ -35,7 +44,10 @@ argon2 [-h] salt [-i|-d|-id] [-t iterations] [-m log2(memory in KiB) | -k memory
## Examples

```bash
# Basic usage
# Basic usage (random salt generated automatically)
echo -n "password" | argon2

# With explicit salt
echo -n "password" | argon2 somesalt

# Use Argon2id with custom parameters
Expand All @@ -45,6 +57,10 @@ echo -n "password" | argon2 somesalt -id -t 4 -m 16 -p 4
echo -n "password" | argon2 somesalt -e
```

## Compatibility

This CLI strives for interface compatibility with the [C reference implementation](https://github.com/P-H-C/phc-winner-argon2), but does not guarantee it. Deviations are made where the original interface significantly hinders usability. For example, the salt is optional in our implementation and a cryptographically secure random salt is generated by default. This CLI also accepts the password via `stdin`, unlike the standard Linux `argon2` CLI, which helps avoid leaking passwords into shell history.

## License

MIT
Loading
Loading