---
name: "encrypt"
section: "1"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/encrypt"
---

# encrypt(1)

encrypt passwords from the command line or standard input

## NAME

**encrypt** – encrypt passwords from the command line or standard input

## SYNOPSIS

**encrypt** \[**-b** *rounds*\] \[**-c** *class*\] \[**-p** \| *string*\]

## DESCRIPTION

**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)](/login.conf/5.md) 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*

  ## SEE ALSO

crypt\_newhash(3), [login.conf(5)](/login.conf/5.md)

## HISTORY

**encrypt** first appeared in OpenBSD 1.2.
