# crypto.password.hash

Hashes the password in --from for storage

# crypto.password.hash

```
crypto.password.hash --from TEXT [--algorithm argon2|bcrypt] [--cost N] → password
```

Hashes the password in `--from` for storage. Choose `--algorithm argon2` (default, argon2id) or `bcrypt` with `--cost` 4–31 (default 12; argon2 refuses it). Adds `password: { hash, algorithm }` and keeps the rest of the payload. An empty `--from` is refused.

## Flags

- `--from` (required): The password to hash. Usually a {{ }} expression.
- `--algorithm`: argon2 (default) or bcrypt.
- `--cost`: bcrypt cost 4-31 (default 12); argon2 refuses it.

## Examples

### Hash a password at registration

```
| crypto.password.hash --from "{{ $trigger.body.password }}"
```

Store `input.password.hash`; the rest of the payload is still there for the INSERT.

It answers:

```json
{
  "password": {
    "hash": "$argon2id$v=19$m=19456,t=2,p=1$…",
    "algorithm": "argon2"
  }
}
```

## Used in

- [Auth and Authorization](/examples/auth-and-authorization.md)
- [Blog with Admin](/examples/blog-with-admin.md)
