add methods to decrypt return data from router
[GitHub/Stricted/speedport-hybrid-php-api.git] / CryptLib / Password / Implementation / Drupal.php
1 <?php
2 /**
3 * The Drupal password hashing implementation
4 *
5 * Use this class to generate and validate Drupal password hashes.
6 *
7 * PHP version 5.3
8 *
9 * @see http://www.openwall.com/phpass/
10 * @category PHPCryptLib
11 * @package Password
12 * @subpackage Implementation
13 * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
14 * @copyright 2011 The Authors
15 * @license http://www.opensource.org/licenses/mit-license.html MIT License
16 * @version Build @@version@@
17 */
18
19 namespace CryptLib\Password\Implementation;
20
21 use CryptLib\Random\Factory as RandomFactory;
22
23 /**
24 * The PHPASS password hashing implementation
25 *
26 * Use this class to generate and validate PHPASS password hashes.
27 *
28 * @see http://www.openwall.com/phpass/
29 * @category PHPCryptLib
30 * @package Password
31 * @subpackage Implementation
32 * @author Anthony Ferrara <ircmaxell@ircmaxell.com>
33 */
34 class Drupal extends PHPASS {
35
36 /**
37 * @var string The prefix for the generated hash
38 */
39 protected static $prefix = '$S$';
40
41 /**
42 * @var string The hash function to use for this instance
43 */
44 protected $hashFunction = 'sha512';
45
46 /**
47 * Determine if the hash was made with this method
48 *
49 * @param string $hash The hashed data to check
50 *
51 * @return boolean Was the hash created by this method
52 */
53 public static function detect($hash) {
54 $prefix = preg_quote(static::$prefix, '/');
55 return 1 == preg_match('/^'.$prefix.'[a-zA-Z0-9.\/]{95}$/', $hash);
56 }
57
58 }