'\" te .\" Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. .TH pwhash 1 "27 Nov 2015" "SunOS 5.11" "User Commands" .SH NAME pwhash \- generate password hashes .SH SYNOPSIS .LP .nf pwhash [ -a <\fIhashalgorithm\fR> | -s <\fIsalt\fR>] [ -u <\fIuser\fR> ] .fi .SH DESCRIPTION .sp .LP With no arguments pwhash prompts for input (and reconfirms) and generates a password hash by using \fBattributes\fR(5) followed by \fBcrypt\fR(3C), and then displays the generated hash on \fBstdout\fR. .sp .LP If input is redirected from \fBstdin\fR then that is used instead. The password is only required once on stdin. When reading from \fBstdin\fR, if the last character is a newline, it is discarded. .SH OPTIONS .sp .LP The following options are supported: .sp .ne 2 .mk .na \fB\fB-a\fR\fR .ad .br .na \fB\fB--algorithm\fR=<\fIalgorithm\fR> \fR .ad .RS 28n .rt Specifies a preference for the algorithm. If the algorithm is not allowed or does not exist, an error is shown. .sp The values are as per the key in \fBcrypt.conf\fR(4). For example, \fB__unix__\fR, \fB1\fR, \fBmd5\fR, \fB2a\fR, \fB5\fR, and \fB6\fR. .RE .sp .ne 2 .mk .na \fB\fB-s\fR\fR .ad .br .na \fB\fB--salt\fR=<\fIsalt\fR>\fR .ad .RS 28n .rt Full specification of the algorithm and salt. This option bypasses the \fBcrypt_gensalt\fR(3C) call and instead passes the supplied salt directly to \fBcrypt\fR(3C). This option is mutually exclusive with \fB-a\fR. .RE .sp .ne 2 .mk .na \fB\fB-u\fR\fR .ad .br .na \fB\fB--user\fR=<\fIuser\fR>\fR .ad .RS 28n .rt Specifies the username to be used with \fBcrypt_gensalt\fR(3C). Note that while the API allows for it, no current plugins delivered with Oracle Solaris for \fBcrypt_gensalt\fR(3C) make use of this. .sp If the user is not found then an error is returned and no hash is generated. .RE .sp .ne 2 .mk .na \fB\fB-h\fR\fR .ad .br .na \fB\fB--help\fR\fR .ad .RS 28n .rt Displays the usage message. .RE .SH EXAMPLES .LP \fBExample 1 \fRGenerating a SHA256 Based Hash Typing in the Password .sp .LP The following example generates a SHA256 based hash typing in the password. .sp .in +2 .nf $ \fBpwhash -a 5\fR Password: Re-enter Password: $5$DA/w/BgH$cB394/iYqj6pk/J6W0smfmKsGrYSGeWUvHsIMnUaZh. .fi .in -2 .sp .LP \fBExample 2 \fRGenerating a Hash Using the System Default Algorithm Using \fBstdin\fR .sp .LP The following example generates a hash by using the system default algorithm using \fBstdin\fR. .sp .in +2 .nf $ \fBpwhash <