add methods to decrypt return data from router
[GitHub/Stricted/speedport-hybrid-php-api.git] / CryptLib / Password / Password.php
diff --git a/CryptLib/Password/Password.php b/CryptLib/Password/Password.php
new file mode 100644 (file)
index 0000000..e2487ce
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * The core password hash interface
+ *
+ * All pasword implementations must implement this interface
+ *
+ * PHP version 5.3
+ *
+ * @category   PHPCryptLib
+ * @package    Password
+ * @author     Anthony Ferrara <ircmaxell@ircmaxell.com>
+ * @copyright  2011 The Authors
+ * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
+ * @version    Build @@version@@
+ */
+
+namespace CryptLib\Password;
+
+/**
+ * The core password key interface
+ *
+ * All pasword implementations must implement this interface
+ *
+ * @category   PHPCryptLib
+ * @package    Password
+ * @author     Anthony Ferrara <ircmaxell@ircmaxell.com>
+ * @codeCoverageIgnore
+ */
+interface Password {
+
+    /**
+     * Determine if the hash was made with this method
+     *
+     * @param string $hash The hashed data to check
+     *
+     * @return boolean Was the hash created by this method
+     */
+    public static function detect($hash);
+
+    /**
+     * Return the prefix used by this hashing method
+     *
+     * @return string The prefix used
+     */
+    public static function getPrefix();
+
+    /**
+     * Load an instance of the class based upon the supplied hash
+     *
+     * @param string $hash The hash to load from
+     *
+     * @return Password the created instance
+     */
+    public static function loadFromHash($hash);
+
+    /**
+     * Create a password hash for a given plain text password
+     *
+     * @param string $password The password to hash
+     *
+     * @return string The formatted password hash
+     */
+    public function create($password);
+
+    /**
+     * Verify a password hash against a given plain text password
+     *
+     * @param string $password The password to hash
+     * @param string $hash     The supplied ahsh to validate
+     *
+     * @return boolean Does the password validate against the hash
+     */
+    public function verify($password, $hash);
+
+}