OpenSSL

密碼學和 SSL/TLS 工具組

openssl-passwd

名稱

openssl-passwd - 計算密碼雜湊

語法

openssl passwd [-help] [-1] [-apr1] [-aixmd5] [-5] [-6] [-salt string] [-in file] [-stdin] [-noverify] [-quiet] [-table] [-reverse] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [password]

說明

此指令會計算在執行階段輸入的密碼雜湊,或是清單中每個密碼的雜湊。密碼清單會從選項 -in 的指定檔案、選項 -stdin 的標準輸入、命令列,或其他終端機取得。

選項

-help

列印使用說明訊息。

-1

使用基於 MD5 的 BSD 密碼演算法 1 (預設)。

-apr1

使用 apr1 演算法 (Apache 變體的 BSD 演算法)。

-aixmd5

使用 AIX MD5 演算法 (AIX 變體的 BSD 演算法)。

-5
-6

使用 Ulrich Drepper 定義的基於 SHA256 / SHA512 的演算法。請參閱 https://www.akkadia.org/drepper/SHA-crypt.txt

-salt string

使用指定的鹽。從終端機讀取密碼時,這表示 -noverify

-in file

file 讀取密碼。

-stdin

stdin 讀取密碼。

-noverify

從終端機讀取密碼時,不要驗證。

-quiet

在命令列中給定的密碼被截斷時,不要輸出警告。

-table

在輸出清單中,在每個密碼雜湊前加上明文密碼和一個 TAB 字元。

-reverse

當使用 -table 選項時,反轉明文和雜湊的順序。

-rand files, -writerand file

有關詳細資訊,請參閱 openssl(1) 中的「隨機狀態選項」

-provider name
-provider-path path
-propquery propq

請參閱 openssl(1) 中的「提供者選項」provider(7)property(7)

範例

% openssl passwd -1 -salt xxxxxxxx password
$1$xxxxxxxx$UYCIxa628.9qXjpQCjM4a.

% openssl passwd -apr1 -salt xxxxxxxx password
$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0

% openssl passwd -aixmd5 -salt xxxxxxxx password
xxxxxxxx$8Oaipk/GPKhC64w/YVeFD/

歷史

-crypt 選項已在 OpenSSL 3.0 中移除。

版權所有 2000-2021 OpenSSL 專案作者。保留所有權利。

在 Apache License 2.0(「授權」)下授權。您只能在遵守授權的情況下使用此檔案。您可以在原始程式碼散佈中的 LICENSE 檔案或 https://www.openssl.org/source/license.html 中取得副本。