Add custom hasher.
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 18 Jan 2019 19:07:28 +0000 (20:07 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 18 Jan 2019 19:07:28 +0000 (20:07 +0100)
src/cas/hashers.py [new file with mode: 0644]

diff --git a/src/cas/hashers.py b/src/cas/hashers.py
new file mode 100644 (file)
index 0000000..c7ae39a
--- /dev/null
@@ -0,0 +1,8 @@
+from django.contrib.auth.hashers import BCryptPasswordHasher
+
+
+class FNPBCryptPasswordHasher(BCryptPasswordHasher):
+    def salt(self):
+        bcrypt = self._load_library()
+        return bcrypt.gensalt(self.rounds, prefix=b"2a")
+