aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-06-15 10:08:45 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-09-14 13:51:10 +0200
commit4b6646d1be63b8e4d099d84d58ae77a485744d1a (patch)
treea8159c3a6f275a4afbca5419d0d87f0462bfd212 /phpBB/includes
parentfbdbf41dc8378c16b37b9e6594107f00dc9a6241 (diff)
downloadforums-4b6646d1be63b8e4d099d84d58ae77a485744d1a.tar
forums-4b6646d1be63b8e4d099d84d58ae77a485744d1a.tar.gz
forums-4b6646d1be63b8e4d099d84d58ae77a485744d1a.tar.bz2
forums-4b6646d1be63b8e4d099d84d58ae77a485744d1a.tar.xz
forums-4b6646d1be63b8e4d099d84d58ae77a485744d1a.zip
[feature/passwords] Add crypto driver base class and interface
PHPBB3-11610
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/crypto/driver/base.php43
-rw-r--r--phpBB/includes/crypto/driver/interface.php56
2 files changed, 99 insertions, 0 deletions
diff --git a/phpBB/includes/crypto/driver/base.php b/phpBB/includes/crypto/driver/base.php
new file mode 100644
index 0000000000..c913767989
--- /dev/null
+++ b/phpBB/includes/crypto/driver/base.php
@@ -0,0 +1,43 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* @package crypto
+*/
+abstract class phpbb_crypto_driver_base implements phpbb_crypto_driver_interface
+{
+ /** @var phpbb_config */
+ protected $config;
+
+ /**
+ * Constructor of crypto driver object
+ *
+ * @return string Hash prefix
+ */
+ public function __construct(phpbb_config $config)
+ {
+ $this->config = $config;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function is_supported()
+ {
+ return true;
+ }
+}
diff --git a/phpBB/includes/crypto/driver/interface.php b/phpBB/includes/crypto/driver/interface.php
new file mode 100644
index 0000000000..b8383bda5a
--- /dev/null
+++ b/phpBB/includes/crypto/driver/interface.php
@@ -0,0 +1,56 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* @package crypto
+*/
+interface phpbb_crypto_driver_interface
+{
+ /**
+ * Check if hash type is supported
+ *
+ * @return bool True if supported, false if not
+ */
+ public function is_supported();
+ /**
+ * Returns the hash prefix
+ *
+ * @return string Hash prefix
+ */
+ public function get_prefix();
+
+ /**
+ * Returns the name of the hash type
+ *
+ * @return string Hash type of driver
+ */
+ public function get_type();
+
+ /**
+ * Hash the password
+ *
+ * @return string Password hash
+ */
+ public function hash($password);
+
+ /**
+ * Check the password against the supplied hash
+ *
+ * @return bool True if password is correct, else false
+ */
+ public function check($password, $hash);
+}