encrypt(1)

encrypt1

Encrypt passwords from the command line or standard input

Usage

encrypt [-b rounds] [-c class] [{-p | string}]

Overview

encrypt prints the encrypted form of string to the standard output. This is mostly useful for encrypting passwords from within scripts.

The options are as follows:

-b rounds

Encrypt the string using Blowfish hashing with the specified number of rounds. May also specify 'a' to request a variable number of rounds scaled to the machine's CPU capabilities.

-c class

Use the cipher type specified in the given user login class. See login.conf(5) for more information.

-p

Prompt for a single string with echo turned off.

If no string is specified, encrypt reads one string per line from standard input, encrypting each one. In the case where no specific algorithm or specific user login class was given as a command line option, the algorithm specified in the default class in /etc/login.conf will be used.

For Blowfish, a new random salt is automatically generated for each password.

Specifying the string on the command line should be discouraged; using the standard input is more secure.

Files

/etc/login.conf

Releases

61 releases since OpenBSD 2.1; the text changed 12 times.

  1. 2.1–2.2
  2. 2.3
  3. 2.4
  4. 2.5
  5. 2.6
  6. 2.7–2.8
  7. 2.9
  8. 3.0–3.3
  9. 3.4–4.0
  10. 4.1
  11. 4.2–5.3
  12. 5.4–5.6
  13. 5.7–8.0

-c since OpenBSD 3.4; -p since OpenBSD 2.6.

-k until OpenBSD 5.6; -m until OpenBSD 5.6; -s until OpenBSD 5.6.

History

encrypt first appeared in OpenBSD 1.2.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.