summaryrefslogtreecommitdiffstats
path: root/debian/tests/sha2-contrib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/sha2-contrib16
1 files changed, 16 insertions, 0 deletions
diff --git a/debian/tests/sha2-contrib b/debian/tests/sha2-contrib
new file mode 100755
index 0000000..32f7637
--- /dev/null
+++ b/debian/tests/sha2-contrib
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+reference_hash="{SHA256}$(echo -n secret | openssl dgst -sha256 -binary | openssl enc -base64)"
+test_hash=$(/usr/sbin/slappasswd -s secret -h '{SHA256}' -o module-load=pw-sha2)
+
+echo "Reference hash of \"secret\" (openssl): ${reference_hash}"
+echo "slapd's pw-sha2 hash: ${test_hash}"
+
+if [ "${reference_hash}" != "${test_hash}" ]; then
+ echo "ERROR: hashes differ"
+ exit 1
+else
+ echo "PASS: hashes are identical"
+fi