functionise Hashing

This commit is contained in:
Adam Warner
2017-05-02 22:24:37 +01:00
parent a5733508ae
commit 9c136a5579
2 changed files with 10 additions and 5 deletions

View File

@@ -1413,9 +1413,9 @@ main() {
pw=""
if [[ $(grep 'WEBPASSWORD' -c /etc/pihole/setupVars.conf) == 0 ]] ; then
pw=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//')
hash=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//')
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
echo "WEBPASSWORD=${hash}" >> ${setupVars}
echo "WEBPASSWORD=$(echo -n ${pw} | sha256sum | sed 's/\s.*$//' | sha256sum | sed 's/\s.*$//')" >> ${setupVars}
fi
fi