Skip to content

Commit fac0fab

Browse files
authored
Merge pull request #3 from Systemscape/joelsa/v020
Improve salt generation and salt checking as well as docs
2 parents d8b54e7 + 73a2588 commit fac0fab

5 files changed

Lines changed: 191 additions & 106 deletions

File tree

Cargo.lock

Lines changed: 65 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "argon2-cli"
3-
version = "0.1.1"
3+
version = "0.2.0"
44
edition = "2024"
55
authors = [
66
"Joel Schulz-Andres <joel@systemscape.de>",
@@ -21,11 +21,12 @@ eula = false
2121

2222
[dependencies]
2323
argon2 = "0.5.3"
24-
clap = { version = "4.5.54", features = ["derive"] }
24+
clap = { version = "4.6.1", features = ["derive"] }
25+
rand_core = { version = "0.6", features = ["getrandom"] }
2526
hex = "0.4.3"
2627

2728
[dev-dependencies]
28-
rand = { version = "0.9.2", features = ["std", "std_rng"] }
29+
rand = { version = "0.9.4", features = ["std", "std_rng"] }
2930

3031
# The profile that 'dist' will build with
3132
[profile.dist]

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,30 @@ Generate Argon2 hashes from command line
55
## Installation
66

77
```bash
8-
cargo install --path .
8+
cargo install argon2-cli
9+
```
10+
11+
Or via [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall):
12+
13+
```bash
14+
cargo binstall argon2-cli
915
```
1016

1117
## Usage
1218

1319
```bash
14-
echo -n "password" | argon2 somesalt
20+
echo -n "password" | argon2
1521
```
1622

23+
This CLI accepts the password via `stdin`, which avoids putting the password in shell history.
24+
1725
### Options
1826

1927
```
20-
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)]
28+
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)]
2129
```
2230

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

3746
```bash
38-
# Basic usage
47+
# Basic usage (random salt generated automatically)
48+
echo -n "password" | argon2
49+
50+
# With explicit salt
3951
echo -n "password" | argon2 somesalt
4052

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

60+
## Compatibility
61+
62+
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.
63+
4864
## License
4965

5066
MIT

0 commit comments

Comments
 (0)