summaryrefslogtreecommitdiff
path: root/lang/python/python-bcrypt/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/python-bcrypt/test.sh')
-rw-r--r--lang/python/python-bcrypt/test.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/lang/python/python-bcrypt/test.sh b/lang/python/python-bcrypt/test.sh
new file mode 100644
index 000000000..9443614f4
--- /dev/null
+++ b/lang/python/python-bcrypt/test.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[ "$1" = python3-bcrypt ] || exit 0
+
+python3 - << EOF
+import sys
+import bcrypt
+password = b"super secret password"
+hashed = bcrypt.hashpw(password, bcrypt.gensalt())
+sys.exit(0 if bcrypt.checkpw(password, hashed) else 1)
+EOF