#!/usr/bin/perl -l

# Enter the password and the two-character salt:
#
# password_encrypt.pl password salt
#
# Example:
#
# password_encrypt.pl 433Xer:J 6x
#
# 6xZ/D.fQ9/.eg
#
# The output is the encrypted password for use in the /etc/shadow file.
#
# This can be used with the "useradd" program as follows (in the bash shell):
#
# useradd -u UID -g GID -c "COMMENT HERE" -s /bin/bash -p $(password_encrypt.pl PASSWORD SALT) USERNAME
#
# just replaced capitalized strings with appropriate terms.
#
# The same encryption format is used for Apache htaccess password AuthUserFile:
#
# username:encrypted_password

print crypt(@ARGV[0], @ARGV[1]);
