Makefile: add pickrand
[cmccabe-bin] / enc.sh
diff --git a/enc.sh b/enc.sh
index a0ec8ef..c399a7e 100755 (executable)
--- a/enc.sh
+++ b/enc.sh
@@ -5,8 +5,16 @@ die() {
     exit 1
 }
 
-[ "x${SALT}" = "x" ] && die "you must set SALT to the salt."
-[ "x${PASS}" = "x" ] && die "you must set PASS to the password"
+if [[ "x${PASS}" = "x" ]]; then
+    read -s -p "enter password: " PASS
+    echo
+    read -s -p "re-enter password: " PASS2
+    [[ ${PASS} == ${PASS2} ]] || die "The passwords did not match."
+fi
+
+#[ "x${SALT}" = "x" ] && die "you must set SALT to the salt."
+#SALT=$(dd count=1024 if=/dev/random 2>/dev/null |md5sum|sed 's/-//')
+#[ $? -ne 0 ] && die "failed to generate SALT"
 
 RET=0
 for FILE in "$@"; do
@@ -18,7 +26,7 @@ for FILE in "$@"; do
             echo "Not encrypting ${FILE} because there is already a ${NEW_FILE}"
         else
             if openssl enc -aes-256-ecb \
-                    -S "${SALT}" \
+                    -salt \
                     -k "${PASS}" < "${FILE}" > "${NEW_FILE}"; then
                 echo "Created ${NEW_FILE}"
             else