]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/GroupBundle/Service/Sha256Salted.php
WIP
[github/wallabag/wallabag.git] / src / Wallabag / GroupBundle / Service / Sha256Salted.php
diff --git a/src/Wallabag/GroupBundle/Service/Sha256Salted.php b/src/Wallabag/GroupBundle/Service/Sha256Salted.php
new file mode 100644 (file)
index 0000000..c72486a
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace Strut\StrutBundle\Service;
+
+use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
+
+class Sha256Salted implements PasswordEncoderInterface
+{
+    public function encodePassword($raw, $salt)
+    {
+        return hash('sha256', $salt . $raw); // Custom function for password encrypt
+    }
+
+    public function isPasswordValid($encoded, $raw, $salt)
+    {
+        return $encoded === $this->encodePassword($raw, $salt);
+    }
+}