aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-05-28 20:02:58 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-06-01 21:31:04 +0200
commit033272f968249a2951cf7dc6867b8f393d113f2d (patch)
tree205e26275c4b365a606c2f114c1ee033891c44d2 /phpBB
parentd9e49fae235217ea60dc95d91822cf04e5024db5 (diff)
downloadforums-033272f968249a2951cf7dc6867b8f393d113f2d.tar
forums-033272f968249a2951cf7dc6867b8f393d113f2d.tar.gz
forums-033272f968249a2951cf7dc6867b8f393d113f2d.tar.bz2
forums-033272f968249a2951cf7dc6867b8f393d113f2d.tar.xz
forums-033272f968249a2951cf7dc6867b8f393d113f2d.zip
[ticket/12352] Add passwords driver for sha1 password hashes
PHPBB3-12352
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/config/passwords.yml8
-rw-r--r--phpBB/phpbb/passwords/driver/sha1.php59
2 files changed, 67 insertions, 0 deletions
diff --git a/phpBB/config/passwords.yml b/phpBB/config/passwords.yml
index 3b21295952..ae989bccf9 100644
--- a/phpBB/config/passwords.yml
+++ b/phpBB/config/passwords.yml
@@ -54,6 +54,14 @@ services:
tags:
- { name: passwords.driver }
+ passwords.driver.sha1:
+ class: phpbb\passwords\driver\sha1
+ arguments:
+ - @config
+ - @passwords.driver_helper
+ tags:
+ - { name: passwords.driver }
+
passwords.driver.phpbb2_md5:
class: phpbb\passwords\driver\phpbb2_md5
arguments:
diff --git a/phpBB/phpbb/passwords/driver/sha1.php b/phpBB/phpbb/passwords/driver/sha1.php
new file mode 100644
index 0000000000..a698392ec6
--- /dev/null
+++ b/phpBB/phpbb/passwords/driver/sha1.php
@@ -0,0 +1,59 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\passwords\driver;
+
+/**
+* @package passwords
+*/
+class sha1 extends base
+{
+ const PREFIX = '$sha1$';
+
+ /**
+ * @inheritdoc
+ */
+ public function get_prefix()
+ {
+ return self::PREFIX;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function is_legacy()
+ {
+ return true;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function hash($password, $user_row = '')
+ {
+ // Do not support hashing
+ return false;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function check($password, $hash, $user_row = array())
+ {
+ return $hash === sha1($password);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function get_settings_only($hash, $full = false)
+ {
+ return false;
+ }
+}